Skip to content

Commit

Permalink
feat: Add pytest fixture in hubfile test
Browse files Browse the repository at this point in the history
  • Loading branch information
drorganvidez committed Oct 10, 2024
1 parent 6f445ab commit f09d0d4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/modules/hubfile/tests/test_unit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from unittest.mock import patch

import pytest

from app.modules.featuremodel.repositories import FeatureModelRepository
from app.modules.hubfile.repositories import HubfileRepository
from app.modules.dataset.repositories import DataSetRepository
Expand All @@ -10,6 +12,19 @@
from dotenv import load_dotenv


@pytest.fixture(scope="module")
def test_client(test_client):
"""
Extends the test_client fixture to add additional specific data for module testing.
"""
with test_client.application.app_context():
# Add HERE new elements to the database that you want to exist in the test context.
# DO NOT FORGET to use db.session.add(<element>) and db.session.commit() to save the data.
pass

yield test_client


def test_create_hubfile_calls_enqueue_task(test_client):
with patch("core.managers.task_queue_manager.TaskQueueManager.enqueue_task") as mock_enqueue_task:
user = UserRepository().create(password="foo")
Expand Down

0 comments on commit f09d0d4

Please sign in to comment.