File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed File renamed without changes.
Original file line number Diff line number Diff line change 55
66import app
77from app .services .location import csbs
8+ from tests .fixtures import mock_client_session
9+ from tests .fixtures import mocked_session_get
810
911
1012def mocked_csbs_requests_get (* args , ** kwargs ):
@@ -21,17 +23,20 @@ def read_file(self):
2123 """
2224 Mock HTTP GET-method and return text from file
2325 """
24- filepath = "tests/example_data/sample_covid19_county .csv"
26+ filepath = "tests/example_data/covid19_county .csv"
2527 print ("Try to read {}" .format (filepath ))
2628 with open (filepath , "r" ) as file :
2729 return file .read ()
2830
2931 return FakeRequestsGetResponse ()
3032
3133
32- @mock .patch ("app.services.location.csbs.requests.get" , side_effect = mocked_csbs_requests_get )
33- def test_get_locations (mock_request_get ):
34- data = csbs .get_locations ()
34+ @pytest .mark .asyncio
35+ async def test_get_locations ():
36+ async with mock_client_session () as mocked_client_session :
37+ mocked_client_session .get = mocked_session_get
38+ data = await csbs .get_locations ()
39+
3540 assert isinstance (data , list )
3641
3742 # check to see that Unknown/Unassigned has been filtered
You can’t perform that action at this time.
0 commit comments