Skip to content

Commit 436a440

Browse files
authored
Merge pull request #84 from gribok/master
Add testcase for root url
2 parents 0aa9566 + b0b6db2 commit 436a440

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_routes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ def read_file_v1(self, state):
2828
expected_json_output = file.read()
2929
return expected_json_output
3030

31+
def test_root_api(self, mock_request_get, mock_datetime):
32+
"""Validate redirections of /"""
33+
mock_datetime.utcnow.return_value.isoformat.return_value = self.date
34+
mock_datetime.strptime.side_effect = mocked_strptime_isoformat
35+
return_data = self.client.get("/")
36+
37+
assert return_data.status_code == 302
38+
39+
assert dict(return_data.headers)["Location"] == \
40+
"https://github.com/ExpDev07/coronavirus-tracker-api"
41+
3142
def test_v1_confirmed(self, mock_request_get, mock_datetime):
3243
mock_datetime.utcnow.return_value.isoformat.return_value = self.date
3344
mock_datetime.strptime.side_effect = mocked_strptime_isoformat

0 commit comments

Comments
 (0)