Skip to content

Commit 2c38d2b

Browse files
author
ExpDev07
committed
now?
1 parent 17eee96 commit 2c38d2b

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

tests/test_jhu.py

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -66,65 +66,6 @@ def isoformat(self):
6666

6767
return DateTimeStrpTime(date, strformat)
6868

69-
@pytest.mark.parametrize("category, datetime_str, latest_value, country_name, \
70-
country_code, province, latest_country_value, \
71-
coordinate_lat, coordinate_long",
72-
[("deaths", DATETIME_STRING, 1940, "Thailand", "TH", "",
73-
114, "15", "101"),
74-
("recovered", DATETIME_STRING, 1940, "Thailand", "TH", "",
75-
114, "15", "101"),
76-
("confirmed", DATETIME_STRING, 1940, "Thailand", "TH", "",
77-
114, "15", "101")])
78-
@mock.patch('app.services.location.jhu.datetime')
79-
@mock.patch('app.services.location.jhu.requests.get', side_effect=mocked_requests_get)
80-
def test_get_category(mock_request_get, mock_datetime, category, datetime_str,
81-
latest_value, country_name, country_code, province, latest_country_value,
82-
coordinate_lat, coordinate_long):
83-
#mock app.services.location.jhu.datetime.utcnow().isoformat()
84-
mock_datetime.utcnow.return_value.isoformat.return_value = datetime_str
85-
output = jhu.get_category(category)
86-
87-
#simple schema validation
88-
assert output["source"] == "https://github.com/ExpDev07/coronavirus-tracker-api"
89-
90-
assert isinstance(output["latest"], int)
91-
assert output["latest"] == latest_value #based on example data
92-
93-
#check for valid datestring
94-
assert date.is_date(output["last_updated"]) is True
95-
#ensure date formating
96-
assert output["last_updated"] == datetime_str + "Z" #based on example data
97-
98-
#validate location schema
99-
location_entry = output["locations"][0]
100-
101-
assert isinstance(location_entry["country"], str)
102-
assert location_entry["country"] == country_name #based on example data
103-
104-
assert isinstance(location_entry["country_code"], str)
105-
assert len(location_entry["country_code"]) == 2
106-
assert location_entry["country_code"] == country_code #based on example data
107-
108-
assert isinstance(location_entry["province"], str)
109-
assert location_entry["province"] == province #based on example data
110-
111-
assert isinstance(location_entry["latest"], int)
112-
assert location_entry["latest"] == latest_country_value #based on example data
113-
114-
#validate coordinates in location
115-
coordinates = location_entry["coordinates"]
116-
117-
assert isinstance(coordinates["lat"], str)
118-
assert coordinates["lat"] == coordinate_lat
119-
120-
assert isinstance(coordinates["long"], str)
121-
assert coordinates["long"] == coordinate_long
122-
123-
#validate history in location
124-
history = location_entry["history"]
125-
assert date.is_date(list(history.keys())[0]) is True
126-
assert isinstance(list(history.values())[0], int)
127-
12869
@mock.patch('app.services.location.jhu.datetime')
12970
@mock.patch('app.services.location.jhu.requests.get', side_effect=mocked_requests_get)
13071
def test_get_locations(mock_request_get, mock_datetime):

0 commit comments

Comments
 (0)