-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconftest.py
More file actions
90 lines (77 loc) · 2.21 KB
/
conftest.py
File metadata and controls
90 lines (77 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
"""
Pytest configuration and fixtures for testing.
This file contains shared fixtures and configuration for all tests.
"""
import pytest
import sys
from pathlib import Path
# Add the parent directory to the path so we can import from src
sys.path.insert(0, str(Path(__file__).parent.parent))
# Configure pytest-asyncio
pytest_plugins = ('pytest_asyncio',)
@pytest.fixture
def sample_movie():
"""Sample movie data for testing."""
return {
"_id": "507f1f77bcf86cd799439011",
"title": "Test Movie",
"year": 2024,
"plot": "A test movie plot",
"genres": ["Action", "Drama"],
"directors": ["Test Director"],
"cast": ["Actor 1", "Actor 2"],
"runtime": 120,
"rated": "PG-13"
}
@pytest.fixture
def sample_movies():
"""Multiple sample movies for testing."""
return [
{
"_id": "507f1f77bcf86cd799439011",
"title": "Test Movie 1",
"year": 2024,
"plot": "First test movie",
"genres": ["Action"],
},
{
"_id": "507f1f77bcf86cd799439012",
"title": "Test Movie 2",
"year": 2023,
"plot": "Second test movie",
"genres": ["Comedy"],
},
{
"_id": "507f1f77bcf86cd799439013",
"title": "Test Movie 3",
"year": 2024,
"plot": "Third test movie",
"genres": ["Drama"],
}
]
@pytest.fixture
def mock_success_response():
"""Mock success response structure."""
def _create_response(data, message="Success"):
return {
"success": True,
"message": message,
"data": data,
"timestamp": "2024-01-01T00:00:00.000Z"
}
return _create_response
@pytest.fixture
def mock_error_response():
"""Mock error response structure."""
def _create_response(message, code=None, details=None):
return {
"success": False,
"message": message,
"error": {
"message": message,
"code": code,
"details": details
},
"timestamp": "2024-01-01T00:00:00.000Z"
}
return _create_response