Skip to content

Commit

Permalink
updated test and executed gradlew
Browse files Browse the repository at this point in the history
  • Loading branch information
Zawar92 authored and marcosmarxm committed Aug 25, 2022
1 parent 229d059 commit e2ff0e8
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp
return response.json().get("data")
return [{"error": "data unavailable on date."}]


def path(
self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None
) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ def test_parse_response(patch_incremental_german_history_cases):
config = {"start_date": "2022-04-27"}
stream = GermanyHistoryCases(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/cases/1")
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
if response.json().get("data"):
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def test_parse_response(patch_incremental_german_history_deaths):
config = {"start_date": "2022-04-27"}
stream = GermanHistoryDeaths(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/deaths/1")
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
if response.json().get("data"):
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def test_parse_response(patch_incremental_german_history_frozenInc):
config = {"start_date": "2022-04-27"}
stream = GermanHistoryFrozenIncidence(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/frozen-incidence/1")
expected_response = response.json().get("data").get("history")
assert stream.parse_response(response) == expected_response
if response.json().get("data").get("history"):
expected_response = response.json().get("data").get("history")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def test_parse_response(patch_incremental_german_history_hospitalization):
config = {"start_date": "2022-04-27"}
stream = GermanHistoryHospitalization(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/hospitalization/1")
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
if response.json().get("data"):
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def test_parse_response(patch_incremental_german_history_incidence):
config = {"start_date": "2022-04-27"}
stream = GermanHistoryIncidence(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/incidence/1")
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
if response.json().get("data"):
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def test_parse_response(patch_incremental_german_history_recovered):
config = {"start_date": "2022-04-27"}
stream = GermanHistoryRecovered(config)
response = requests.get("https://api.corona-zahlen.org/germany/history/recovered/1")
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
if response.json().get("data"):
expected_response = response.json().get("data")
assert stream.parse_response(response) == expected_response
else:
expected_response = [{"error": "data unavailable on date."}]
assert stream.parse_response(response) == expected_response


def check_diff(start_date):
Expand Down

0 comments on commit e2ff0e8

Please sign in to comment.