diff --git a/.gitea/workflows/dev-deployment.yaml b/.gitea/workflows/dev-deployment.yaml index 68bb244..5568b8c 100644 --- a/.gitea/workflows/dev-deployment.yaml +++ b/.gitea/workflows/dev-deployment.yaml @@ -26,11 +26,10 @@ jobs: - name: 📦 Install dependencies and run tests run: | - cd apps python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -r apps/requirements.txt pip install pytest pytest-mock - pytest tests/ -v --tb=short + pytest apps/tests/ -v --tb=short - name: 🔄 Cache id: cache diff --git a/apps/tests/conftest.py b/apps/tests/conftest.py index ee7245e..046fde5 100644 --- a/apps/tests/conftest.py +++ b/apps/tests/conftest.py @@ -1,56 +1,5 @@ -import pytest -from unittest.mock import MagicMock -from flask import Flask +import sys +import os - -@pytest.fixture -def app(): - """Create Flask test app""" - app = Flask(__name__) - app.config["TESTING"] = True - return app - - -@pytest.fixture -def client(app): - """Create Flask test client""" - return app.test_client() - - -@pytest.fixture -def mock_db_connection(): - """Mock database connection""" - mock_conn = MagicMock() - mock_cursor = MagicMock() - - mock_conn.__enter__ = MagicMock(return_value=mock_conn) - mock_conn.__exit__ = MagicMock(return_value=False) - mock_conn.cursor.return_value.__enter__ = MagicMock(return_value=mock_cursor) - mock_conn.cursor.return_value.__exit__ = MagicMock(return_value=False) - - return mock_conn, mock_cursor - - -@pytest.fixture -def sample_user_data(): - """Sample user data for testing""" - return { - "name": "John Doe", - "email": "john@example.com", - "dob": "1990-01-01", - "gender": "male" - } - - -@pytest.fixture -def sample_filter_params(): - """Sample filter parameters for testing""" - return { - "page": 0, - "size": 8, - "asc": "false", - "filter[keyword]": "test", - "filter[name]": "John", - "filter[email]": "john@example.com", - "filter[gender]": "male", - } +# Add apps directory to path for imports +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))