Skip to content

Commit 1beb2b5

Browse files
committed
Adjust test cases for refactor
1 parent ecb0cc3 commit 1beb2b5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

services/question-service/app/core/crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import uuid
22
from typing import List, Dict, Optional
3-
from utils import get_conn, upload_to_s3, get_from_s3, delete_from_s3
3+
from app.core.utils import get_conn, upload_to_s3, get_from_s3, delete_from_s3
44
from app.models.exceptions import QuestionNotFoundException
55

66
def list_difficulties_and_topics() -> Dict[str, List[str]]:

services/question-service/tests/test_crud.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
from unittest.mock import MagicMock, patch
33
import pytest
44

5-
from app import crud
5+
from app.core import crud
66
from app.models.exceptions import QuestionNotFoundException
77

88
# --- Mocks Setup ---
99

1010
@pytest.fixture
1111
def mock_db_conn():
1212
"""Fixture to mock the database connection and cursor."""
13-
with patch('app.crud.get_conn') as mock_get_conn:
13+
with patch('app.core.crud.get_conn') as mock_get_conn:
1414
mock_conn = MagicMock()
1515
mock_cursor = MagicMock()
1616
mock_cursor.connection = mock_conn
@@ -21,9 +21,9 @@ def mock_db_conn():
2121
@pytest.fixture
2222
def mock_s3():
2323
"""Fixture to mock all S3 utility functions."""
24-
with patch('app.crud.upload_to_s3') as mock_upload, \
25-
patch('app.crud.get_from_s3') as mock_get, \
26-
patch('app.crud.delete_from_s3') as mock_delete:
24+
with patch('app.core.crud.upload_to_s3') as mock_upload, \
25+
patch('app.core.crud.get_from_s3') as mock_get, \
26+
patch('app.core.crud.delete_from_s3') as mock_delete:
2727
yield {
2828
"upload": mock_upload,
2929
"get": mock_get,
@@ -35,9 +35,9 @@ def mock_s3():
3535
@pytest.fixture
3636
def mock_question_funcs():
3737
"""Mock all external question functions"""
38-
with patch('app.crud.get_question') as mock_get, \
39-
patch('app.crud.delete_question') as mock_delete, \
40-
patch('app.crud.create_question') as mock_create:
38+
with patch('app.core.crud.get_question') as mock_get, \
39+
patch('app.core.crud.delete_question') as mock_delete, \
40+
patch('app.core.crud.create_question') as mock_create:
4141
yield mock_get, mock_delete, mock_create
4242

4343

services/question-service/tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33
import boto3
44
from moto import mock_aws
5-
from app.utils import upload_to_s3, get_from_s3, delete_from_s3
5+
from app.core.utils import upload_to_s3, get_from_s3, delete_from_s3
66

77
@pytest.fixture(scope="function")
88
def aws_credentials():

0 commit comments

Comments
 (0)