File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33from fastapi .testclient import TestClient
44import json
55from unittest import mock
6+ from pprint import pformat as pf
67import pytest
78from app import services
89from app .main import APP
@@ -128,10 +129,34 @@ def tearDown(self):
128129 {"source" : "jhu" },
129130 {"timelines" : True },
130131 {"timelines" : "true" },
132+ {"timelines" : 1 },
131133 {"source" : "jhu" , "timelines" : True },
132134 ],
133135)
134136def test_locations_status_code (api_client , query_params ):
135137 response = api_client .get ("/v2/locations" , params = query_params )
136138 print (f"GET { response .url } \n { response } " )
137139 assert response .status_code == 200
140+
141+
142+ @pytest .mark .parametrize (
143+ "query_params" ,
144+ [
145+ {"source" : "csbs" },
146+ {"source" : "jhu" },
147+ {"timelines" : True },
148+ {"timelines" : "true" },
149+ {"timelines" : 1 },
150+ {"source" : "jhu" , "timelines" : True },
151+ ],
152+ )
153+ def test_latest (api_client , query_params ):
154+ response = api_client .get ("/v2/latest" , params = query_params )
155+ print (f"GET { response .url } \n { response } " )
156+
157+ response_json = response .json ()
158+ print (f"\t json:\n { pf (response_json )} " )
159+
160+ assert response .status_code == 200
161+ assert response_json ["latest" ]["confirmed" ]
162+ assert response_json ["latest" ]["deaths" ]
You can’t perform that action at this time.
0 commit comments