File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ def test_fetch_filter_data_basic(create_test_client):
4343def test_fetch_chart_data_with_filters_basic (create_test_client ):
4444 with patch ("api.api_routes.ChartService" ) as MockChartService :
4545 mock_instance = MockChartService .return_value
46- mock_instance .fetch_chart_data_with_filters = AsyncMock (return_value = {"filtered" : True })
46+ mock_instance .fetch_chart_data_with_filters = AsyncMock (return_value = [
47+ {
48+ "id" : "TOTAL_CALLS" ,
49+ "chart_name" : "Total Calls" ,
50+ "chart_type" : "card" ,
51+ "chart_value" : [
52+ {"name" : "Total Calls" , "value" : float ("nan" ), "unit_of_measurement" : "" }
53+ ]
54+ }
55+ ])
4756
4857 client = create_test_client ()
4958 payload = {
@@ -54,9 +63,18 @@ def test_fetch_chart_data_with_filters_basic(create_test_client):
5463 }
5564 }
5665 response = client .post ("/fetchChartDataWithFilters" , json = payload )
57-
66+ expected = [
67+ {
68+ "id" : "TOTAL_CALLS" ,
69+ "chart_name" : "Total Calls" ,
70+ "chart_type" : "card" ,
71+ "chart_value" : [
72+ {"name" : "Total Calls" , "value" : None , "unit_of_measurement" : "" }
73+ ]
74+ }
75+ ]
5876 assert response .status_code == 200
59- assert response .json () == { "filtered" : True }
77+ assert response .json () == expected
6078
6179def test_fetch_chart_data_with_filters_error (create_test_client ):
6280 with patch ("api.api_routes.ChartService" ) as MockChartService :
You can’t perform that action at this time.
0 commit comments