Skip to content

Commit 71bfe04

Browse files
committed
test: fix colors in dashboard test
1 parent 9d26a38 commit 71bfe04

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/analysis/test_dashboard_parser.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def test_parser_logic(mock_url_for):
1212
# Case 1: Active Survey - Gathering State (1 <= N < 30) -> "orange"
1313
gathering_survey = {
1414
"id": 42,
15+
"active": True,
1516
"created_at": datetime(2026, 2, 9, 14, 30, 0),
1617
"pair_generation_config": '{"strategy":"sign_symmetry","params":{"x":1}}',
1718
"title": '{"en":"Municipal Budget Study","he":"מחקר תקציב עירוני"}',
@@ -22,6 +23,7 @@ def test_parser_logic(mock_url_for):
2223
# Case 2: Sufficient Survey (N >= 30) -> "green"
2324
sufficient_survey = {
2425
"id": 43,
26+
"active": True,
2527
"created_at": datetime(2026, 2, 9, 14, 30, 0),
2628
"participant_count": 55,
2729
}
@@ -36,14 +38,24 @@ def test_parser_logic(mock_url_for):
3638
"participant_count": None,
3739
}
3840

41+
# Case 4: Active Survey - No responses (N = 0) -> "red"
42+
no_response_survey = {
43+
"id": 44,
44+
"active": True,
45+
"created_at": datetime(2026, 2, 9, 14, 30, 0),
46+
"participant_count": 0,
47+
}
48+
3949
gathering_result = parse_survey_data(gathering_survey)
4050
sufficient_result = parse_survey_data(sufficient_survey)
4151
empty_result = parse_survey_data(empty_bad_survey)
52+
no_response_result = parse_survey_data(no_response_survey)
4253

4354
expected_keys = {
4455
"id",
4556
"ui_date",
4657
"ui_status",
58+
"ui_status_priority",
4759
"ui_status_tooltip",
4860
"is_active_data",
4961
"ui_strategy",
@@ -62,6 +74,7 @@ def test_parser_logic(mock_url_for):
6274

6375
# --- Gathering State (Orange) Assertions ---
6476
assert gathering_result["ui_status"] == "orange"
77+
assert gathering_result["ui_status_priority"] == 2
6578
assert gathering_result["is_active_data"] is True
6679
assert gathering_result["ui_strategy"] == "Sign Symmetry"
6780
assert gathering_result["ui_context"] == "Municipal Budget Study"
@@ -71,10 +84,18 @@ def test_parser_logic(mock_url_for):
7184

7285
# --- Sufficient State (Green) Assertions ---
7386
assert sufficient_result["ui_status"] == "green"
87+
assert sufficient_result["ui_status_priority"] == 3
7488
assert sufficient_result["ui_volume"] == 55
7589

90+
# --- No Response State (Red) Assertions ---
91+
assert no_response_result["ui_status"] == "red"
92+
assert no_response_result["ui_status_priority"] == 1
93+
assert no_response_result["ui_volume"] == 0
94+
assert no_response_result["is_active_data"] is False
95+
7696
# --- Empty/Bad Data (Gray) Assertions ---
7797
assert empty_result["ui_status"] == "gray"
98+
assert empty_result["ui_status_priority"] == 0
7899
assert empty_result["is_active_data"] is False
79100
assert empty_result["ui_strategy"] == "Unknown"
80101
assert empty_result["ui_dimension"] == "N/A"

0 commit comments

Comments
 (0)