add new
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 12s
Some checks failed
K8S Fission Deployment / Deployment fission functions (push) Failing after 12s
This commit is contained in:
56
apps/tests/conftest.py
Normal file
56
apps/tests/conftest.py
Normal file
@@ -0,0 +1,56 @@
|
||||
import pytest
|
||||
from unittest.mock import MagicMock
|
||||
from flask import Flask
|
||||
|
||||
|
||||
@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",
|
||||
}
|
||||
Reference in New Issue
Block a user