airbyte-source-rki-covid 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_source_rki_covid-0.1.3.dist-info/METADATA +110 -0
- airbyte_source_rki_covid-0.1.3.dist-info/RECORD +25 -0
- {airbyte_source_rki_covid-0.1.2.dist-info → airbyte_source_rki_covid-0.1.3.dist-info}/WHEEL +1 -2
- airbyte_source_rki_covid-0.1.3.dist-info/entry_points.txt +3 -0
- source_rki_covid/schemas/TODO.md +30 -0
- airbyte_source_rki_covid-0.1.2.dist-info/METADATA +0 -119
- airbyte_source_rki_covid-0.1.2.dist-info/RECORD +0 -53
- airbyte_source_rki_covid-0.1.2.dist-info/entry_points.txt +0 -2
- airbyte_source_rki_covid-0.1.2.dist-info/top_level.txt +0 -3
- integration_tests/__init__.py +0 -3
- integration_tests/abnormal_state.json +0 -44
- integration_tests/acceptance.py +0 -14
- integration_tests/configured_catalog.json +0 -861
- integration_tests/invalid_config.json +0 -3
- integration_tests/sample_config.json +0 -3
- integration_tests/sample_state.json +0 -18
- unit_tests/__init__.py +0 -3
- unit_tests/test_cached_stream_state.py +0 -5
- unit_tests/test_incremental_germanhistorycases.py +0 -56
- unit_tests/test_incremental_germanhistorydeaths.py +0 -66
- unit_tests/test_incremental_germanhistoryfrozenIncidence.py +0 -66
- unit_tests/test_incremental_germanhistoryhospitalization.py +0 -66
- unit_tests/test_incremental_germanhistoryincidence.py +0 -66
- unit_tests/test_incremental_germanhistoryrecovered.py +0 -66
- unit_tests/test_incremental_streams.py +0 -52
- unit_tests/test_source.py +0 -21
- unit_tests/test_stateshistorycases.py +0 -29
- unit_tests/test_stateshistorydeaths.py +0 -29
- unit_tests/test_stateshistoryfrozenincidence.py +0 -29
- unit_tests/test_stateshistoryhospitalization.py +0 -29
- unit_tests/test_stateshistoryincidence.py +0 -29
- unit_tests/test_stateshistoryrecovered.py +0 -29
- unit_tests/test_stream_agegroup.py +0 -18
- unit_tests/test_stream_germany.py +0 -18
- unit_tests/test_stream_germany_states.py +0 -18
- unit_tests/test_streams.py +0 -67
- unit_tests/test_streams_states_agegroup.py +0 -18
@@ -1,29 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
from datetime import datetime
|
7
|
-
|
8
|
-
from pytest import fixture
|
9
|
-
from source_rki_covid.source import StatesHistoryRecovered
|
10
|
-
|
11
|
-
|
12
|
-
@fixture
|
13
|
-
def patch_states_history_recovered(mocker):
|
14
|
-
# Mock abstract methods to enable instantiating abstract class
|
15
|
-
mocker.patch.object(StatesHistoryRecovered, "primary_key", None)
|
16
|
-
|
17
|
-
|
18
|
-
def check_diff(start_date):
|
19
|
-
diff = datetime.now() - datetime.strptime(start_date, "%Y-%m-%d")
|
20
|
-
if diff.days <= 0:
|
21
|
-
return str(1)
|
22
|
-
return str(diff.days)
|
23
|
-
|
24
|
-
|
25
|
-
def test_parse_with_cases(patch_states_history_recovered):
|
26
|
-
config = {"start_date": "2022-04-27"}
|
27
|
-
stream = StatesHistoryRecovered(config)
|
28
|
-
expected_stream_path = "states/history/recovered/" + check_diff(config.get("start_date"))
|
29
|
-
assert stream.path() == expected_stream_path
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
import pytest
|
6
|
-
from source_rki_covid.source import GermanyAgeGroups
|
7
|
-
|
8
|
-
|
9
|
-
@pytest.fixture
|
10
|
-
def patch_age_group(mocker):
|
11
|
-
# Mock abstract methods to enable instantiating abstract class
|
12
|
-
mocker.patch.object(GermanyAgeGroups, "primary_key", None)
|
13
|
-
|
14
|
-
|
15
|
-
def test_path(patch_age_group):
|
16
|
-
stream = GermanyAgeGroups()
|
17
|
-
expected_params = {"path": "germany/age-groups"}
|
18
|
-
assert stream.path() == expected_params.get("path")
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
import pytest
|
6
|
-
from source_rki_covid.source import Germany
|
7
|
-
|
8
|
-
|
9
|
-
@pytest.fixture
|
10
|
-
def patch_germany_class(mocker):
|
11
|
-
# Mock abstract methods to enable instantiating abstract class
|
12
|
-
mocker.patch.object(Germany, "primary_key", None)
|
13
|
-
|
14
|
-
|
15
|
-
def test_path(patch_germany_class):
|
16
|
-
stream = Germany()
|
17
|
-
expected_params = {"path": "germany/"}
|
18
|
-
assert stream.path() == expected_params.get("path")
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
import pytest
|
6
|
-
from source_rki_covid.source import GermanyStates
|
7
|
-
|
8
|
-
|
9
|
-
@pytest.fixture
|
10
|
-
def patch_germany_states_class(mocker):
|
11
|
-
# Mock abstract methods to enable instantiating abstract class
|
12
|
-
mocker.patch.object(GermanyStates, "primary_key", None)
|
13
|
-
|
14
|
-
|
15
|
-
def test_path(patch_germany_states_class):
|
16
|
-
stream = GermanyStates()
|
17
|
-
expected_params = {"path": "states/"}
|
18
|
-
assert stream.path() == expected_params.get("path")
|
unit_tests/test_streams.py
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
from http import HTTPStatus
|
6
|
-
from unittest.mock import MagicMock
|
7
|
-
|
8
|
-
import pytest
|
9
|
-
from source_rki_covid.source import RkiCovidStream
|
10
|
-
|
11
|
-
|
12
|
-
@pytest.fixture
|
13
|
-
def patch_base_class(mocker):
|
14
|
-
# Mock abstract methods to enable instantiating abstract class
|
15
|
-
mocker.patch.object(RkiCovidStream, "path", "v0/example_endpoint")
|
16
|
-
mocker.patch.object(RkiCovidStream, "primary_key", "test_primary_key")
|
17
|
-
mocker.patch.object(RkiCovidStream, "__abstractmethods__", set())
|
18
|
-
|
19
|
-
|
20
|
-
def test_request_params(patch_base_class):
|
21
|
-
stream = RkiCovidStream()
|
22
|
-
inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None}
|
23
|
-
expected_params = {}
|
24
|
-
assert stream.request_params(**inputs) == expected_params
|
25
|
-
|
26
|
-
|
27
|
-
def test_next_page_token(patch_base_class):
|
28
|
-
stream = RkiCovidStream()
|
29
|
-
inputs = {"response": MagicMock()}
|
30
|
-
expected_token = None
|
31
|
-
assert stream.next_page_token(**inputs) == expected_token
|
32
|
-
|
33
|
-
|
34
|
-
def test_request_headers(patch_base_class):
|
35
|
-
stream = RkiCovidStream()
|
36
|
-
inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None}
|
37
|
-
expected_headers = {}
|
38
|
-
assert stream.request_headers(**inputs) == expected_headers
|
39
|
-
|
40
|
-
|
41
|
-
def test_http_method(patch_base_class):
|
42
|
-
stream = RkiCovidStream()
|
43
|
-
expected_method = "GET"
|
44
|
-
assert stream.http_method == expected_method
|
45
|
-
|
46
|
-
|
47
|
-
@pytest.mark.parametrize(
|
48
|
-
("http_status", "should_retry"),
|
49
|
-
[
|
50
|
-
(HTTPStatus.OK, False),
|
51
|
-
(HTTPStatus.BAD_REQUEST, False),
|
52
|
-
(HTTPStatus.TOO_MANY_REQUESTS, True),
|
53
|
-
(HTTPStatus.INTERNAL_SERVER_ERROR, True),
|
54
|
-
],
|
55
|
-
)
|
56
|
-
def test_should_retry(patch_base_class, http_status, should_retry):
|
57
|
-
response_mock = MagicMock()
|
58
|
-
response_mock.status_code = http_status
|
59
|
-
stream = RkiCovidStream()
|
60
|
-
assert stream.should_retry(response_mock) == should_retry
|
61
|
-
|
62
|
-
|
63
|
-
def test_backoff_time(patch_base_class):
|
64
|
-
response_mock = MagicMock()
|
65
|
-
stream = RkiCovidStream()
|
66
|
-
expected_backoff_time = None
|
67
|
-
assert stream.backoff_time(response_mock) == expected_backoff_time
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
|
3
|
-
#
|
4
|
-
|
5
|
-
import pytest
|
6
|
-
from source_rki_covid.source import GermanyStatesAgeGroups
|
7
|
-
|
8
|
-
|
9
|
-
@pytest.fixture
|
10
|
-
def patch_states_age_group(mocker):
|
11
|
-
# Mock abstract methods to enable instantiating abstract class
|
12
|
-
mocker.patch.object(GermanyStatesAgeGroups, "primary_key", None)
|
13
|
-
|
14
|
-
|
15
|
-
def test_path(patch_states_age_group):
|
16
|
-
stream = GermanyStatesAgeGroups()
|
17
|
-
expected_params = {"path": "states/age-groups"}
|
18
|
-
assert stream.path() == expected_params.get("path")
|