diff --git a/airbyte-integrations/connectors/source-rki-covid/source_rki_covid/source.py b/airbyte-integrations/connectors/source-rki-covid/source_rki_covid/source.py index 2d7ad113872c..ca43ba02ce4e 100644 --- a/airbyte-integrations/connectors/source-rki-covid/source_rki_covid/source.py +++ b/airbyte-integrations/connectors/source-rki-covid/source_rki_covid/source.py @@ -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: diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorycases.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorycases.py index 24cb6450bbd5..e59c76341f04 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorycases.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorycases.py @@ -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): diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorydeaths.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorydeaths.py index 7c73f7d31d3f..59ae8b66449d 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorydeaths.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistorydeaths.py @@ -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): diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryfrozenIncidence.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryfrozenIncidence.py index 3d59f4617ba6..6f542b699906 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryfrozenIncidence.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryfrozenIncidence.py @@ -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): diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryhospitalization.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryhospitalization.py index 636c3cb6e8f9..0c5b8ed1d917 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryhospitalization.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryhospitalization.py @@ -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): diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryincidence.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryincidence.py index 25bb4f88e2d5..6c5cbef8676f 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryincidence.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryincidence.py @@ -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): diff --git a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryrecovered.py b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryrecovered.py index 20bd3aa3fbc6..f5b4bef29d9d 100644 --- a/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryrecovered.py +++ b/airbyte-integrations/connectors/source-rki-covid/unit_tests/test_incremental_germanhistoryrecovered.py @@ -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):