Skip to content

Commit 7f97927

Browse files
committed
feat: Complete Flask backend refactoring with comprehensive test suite
- Finalize pytest infrastructure with database mocking - Enable full test coverage for modular Blueprint architecture - Prepare foundation for FastAPI + Airflow parallel development - Support OpenBB Platform (Linux Foundation FINOS member) integration patterns - Resolve test suite blockers through comprehensive mock data configuration
1 parent f449069 commit 7f97927

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

backend/tests/conftest.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,36 @@ def execute_side_effect(query, params=None):
4343
mock_cursor.fetchall.return_value = mock_quarterly_reports_data
4444
elif "select prices_pe.* from prices_pe" in query_lower:
4545
mock_cursor.fetchall.return_value = mock_prices_pe_data
46+
elif "select distinct(sub_industries.sector_gics)" in query_lower:
47+
# Mock sector names query
48+
mock_cursor.fetchall.return_value = [('Information Technology',), ('Healthcare',), ('Energy',)]
49+
elif "select distinct(sub_industries.sub_industry_gics)" in query_lower:
50+
# Mock sub-sector names query
51+
mock_cursor.fetchall.return_value = [('Application Software',), ('Systems Software',)]
52+
elif "extract(year from date::date) as year" in query_lower and "avg(revenue)" in query_lower:
53+
# Mock sector quarterly financials query
54+
mock_cursor.fetchall.return_value = [
55+
('Information Technology', 2023, 4, 1000.0, 200.0, 2.5, 0.20),
56+
('Information Technology', 2024, 1, 1100.0, 220.0, 2.7, 0.22)
57+
]
58+
elif "extract(year from date::date) as year" in query_lower and "avg(closing_price)" in query_lower:
59+
# Mock sector price PE query
60+
mock_cursor.fetchall.return_value = [
61+
(2023, 4, 150.0, 25.0),
62+
(2024, 1, 160.0, 26.0)
63+
]
64+
elif "sub_industry_gics" in query_lower and "avg(revenue)" in query_lower:
65+
# Mock sub-sector quarterly financials query
66+
mock_cursor.fetchall.return_value = [
67+
('Application Software', 2023, 4, 1200.0, 240.0, 3.0, 0.25),
68+
('Application Software', 2024, 1, 1300.0, 260.0, 3.2, 0.27)
69+
]
70+
elif "sub_industry_gics" in query_lower and "avg(closing_price)" in query_lower:
71+
# Mock sub-sector price PE query
72+
mock_cursor.fetchall.return_value = [
73+
('Application Software', 2023, 4, 180.0, 30.0),
74+
('Application Software', 2024, 1, 190.0, 31.0)
75+
]
4676
else:
4777
mock_cursor.fetchall.return_value = [] # Default to empty list for unmocked queries
4878

0 commit comments

Comments
 (0)