From 01778df97eed302d9242183b807bbee8d7829783 Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Thu, 23 Sep 2021 18:21:40 -0300 Subject: [PATCH 1/5] add additional pip install for tests --- .../connector-templates/source-python-http-api/README.md.hbs | 1 + 1 file changed, 1 insertion(+) diff --git a/airbyte-integrations/connector-templates/source-python-http-api/README.md.hbs b/airbyte-integrations/connector-templates/source-python-http-api/README.md.hbs index 15069073a444..285df113f90a 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/README.md.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/README.md.hbs @@ -21,6 +21,7 @@ development environment of choice. To activate it from the terminal, run: ``` source .venv/bin/activate pip install -r requirements.txt +pip install '.[tests]' ``` If you are in an IDE, follow your IDE's instructions to activate the virtualenv. From 7d824e09136a106696d0ae23396bb7f4455fbc96 Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Thu, 23 Sep 2021 18:28:54 -0300 Subject: [PATCH 2/5] run gradlew test scaffold --- .../source-scaffold-source-http/README.md | 1 + .../unit_tests/__init__.py | 23 ++++ .../unit_tests/test_incremental_streams.py | 80 ++++++++++++++ .../unit_tests/test_source.py | 40 +++++++ .../unit_tests/test_streams.py | 103 ++++++++++++++++++ 5 files changed, 247 insertions(+) create mode 100644 airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/__init__.py create mode 100644 airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py create mode 100644 airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py create mode 100644 airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/README.md b/airbyte-integrations/connectors/source-scaffold-source-http/README.md index 0902dbf58911..f238246865e1 100644 --- a/airbyte-integrations/connectors/source-scaffold-source-http/README.md +++ b/airbyte-integrations/connectors/source-scaffold-source-http/README.md @@ -21,6 +21,7 @@ development environment of choice. To activate it from the terminal, run: ``` source .venv/bin/activate pip install -r requirements.txt +pip install '.[tests]' ``` If you are in an IDE, follow your IDE's instructions to activate the virtualenv. diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/__init__.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/__init__.py new file mode 100644 index 000000000000..9db886e0930f --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/__init__.py @@ -0,0 +1,23 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py new file mode 100644 index 000000000000..5504ef10cf92 --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py @@ -0,0 +1,80 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +from pytest import fixture +from unittest.mock import MagicMock + +from airbyte_cdk.models import SyncMode +from source_scaffold_source_http.source import IncrementalScaffoldSourceHttpStream + + +@fixture +def patch_incremental_base_class(mocker): + # Mock abstract methods to enable instantiating abstract class + mocker.patch.object(IncrementalScaffoldSourceHttpStream, "path", "v0/example_endpoint") + mocker.patch.object(IncrementalScaffoldSourceHttpStream, "primary_key", "test_primary_key") + mocker.patch.object(IncrementalScaffoldSourceHttpStream, "__abstractmethods__", set()) + + +def test_cursor_field(patch_incremental_base_class): + stream = IncrementalScaffoldSourceHttpStream() + # TODO: replace this with your expected cursor field + expected_cursor_field = [] + assert stream.cursor_field == expected_cursor_field + + +def test_get_updated_state(patch_incremental_base_class): + stream = IncrementalScaffoldSourceHttpStream() + expected_cursor_field = [] + # TODO: replace this with your input parameters + inputs = {"current_stream_state": None, "latest_record": None} + # TODO: replace this with your expected updated stream state + expected_state = {} + assert stream.get_updated_state(**inputs) == expected_state + + +def test_stream_slices(patch_incremental_base_class): + stream = IncrementalScaffoldSourceHttpStream() + expected_cursor_field = [] + # TODO: replace this with your input parameters + inputs = {"sync_mode": SyncMode.incremental, "cursor_field": [], "stream_state": {}} + # TODO: replace this with your expected stream slices list + expected_stream_slice = [None] + assert stream.stream_slices(**inputs) == expected_stream_slice + + +def test_supports_incremental(patch_incremental_base_class, mocker): + mocker.patch.object(IncrementalScaffoldSourceHttpStream, "cursor_field", "dummy_field") + stream = IncrementalScaffoldSourceHttpStream() + assert stream.supports_incremental + +def test_source_defined_cursor(patch_incremental_base_class): + stream = IncrementalScaffoldSourceHttpStream() + assert stream.source_defined_cursor + +def test_stream_checkpoint_interval(patch_incremental_base_class): + stream = IncrementalScaffoldSourceHttpStream() + # TODO: replace this with your expected checkpoint interval + expected_checkpoint_interval = None + assert stream.state_checkpoint_interval == expected_checkpoint_interval diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py new file mode 100644 index 000000000000..d55d352e88a3 --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py @@ -0,0 +1,40 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +from source_scaffold_source_http.source import SourceScaffoldSourceHttp +from unittest.mock import MagicMock + + +def test_check_connection(mocker): + source = SourceScaffoldSourceHttp() + logger_mock, config_mock = MagicMock(), MagicMock() + assert source.check_connection(logger_mock, config_mock) == (True, None) + +def test_streams(mocker): + source = SourceScaffoldSourceHttp() + config_mock = MagicMock() + streams = source.streams(config_mock) + # TODO: replace this with your streams number + expected_streams_number = 2 + assert len(streams) == expected_streams_number diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py new file mode 100644 index 000000000000..86fa7e34f02e --- /dev/null +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py @@ -0,0 +1,103 @@ +# +# MIT License +# +# Copyright (c) 2020 Airbyte +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +from http import HTTPStatus +from unittest.mock import MagicMock +import pytest + +from source_scaffold_source_http.source import ScaffoldSourceHttpStream + + +@pytest.fixture +def patch_base_class(mocker): + # Mock abstract methods to enable instantiating abstract class + mocker.patch.object(ScaffoldSourceHttpStream, "path", "v0/example_endpoint") + mocker.patch.object(ScaffoldSourceHttpStream, "primary_key", "test_primary_key") + mocker.patch.object(ScaffoldSourceHttpStream, "__abstractmethods__", set()) + + +def test_request_params(patch_base_class): + stream = ScaffoldSourceHttpStream() + # TODO: replace this with your input parameters + inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} + # TODO: replace this with your expected request parameters + expected_params = {} + assert stream.request_params(**inputs) == expected_params + + +def test_next_page_token(patch_base_class): + stream = ScaffoldSourceHttpStream() + # TODO: replace this with your input parameters + inputs = {"response": MagicMock()} + # TODO: replace this with your expected next page token + expected_token = None + assert stream.next_page_token(**inputs) == expected_token + + +def test_parse_response(patch_base_class): + stream = ScaffoldSourceHttpStream() + # TODO: replace this with your input parameters + inputs = {"response": MagicMock()} + # TODO: replace this with your expected parced object + expected_parsed_object = {} + assert next(stream.parse_response(**inputs)) == expected_parsed_object + + +def test_request_headers(patch_base_class): + stream = ScaffoldSourceHttpStream() + # TODO: replace this with your input parameters + inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} + # TODO: replace this with your expected request headers + expected_headers = {} + assert stream.request_headers(**inputs) == {} + + +def test_http_method(patch_base_class): + stream = ScaffoldSourceHttpStream() + # TODO: replace this with your expected http request method + expected_method = "GET" + assert stream.http_method == expected_method + + +@pytest.mark.parametrize( + ("http_status", "should_retry"), + [ + (HTTPStatus.OK, False), + (HTTPStatus.BAD_REQUEST, False), + (HTTPStatus.TOO_MANY_REQUESTS, True), + (HTTPStatus.INTERNAL_SERVER_ERROR, True), + ], +) +def test_should_retry(patch_base_class, http_status, should_retry): + response_mock = MagicMock() + response_mock.status_code = http_status + stream = ScaffoldSourceHttpStream() + assert stream.should_retry(response_mock) == should_retry + + +def test_backoff_time(patch_base_class): + response_mock = MagicMock() + stream = ScaffoldSourceHttpStream() + expected_backoff_time = None + assert stream.backoff_time(response_mock) == expected_backoff_time From 07bb0c1b8d21c5f1d71d682a058268fbd26fedf0 Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Thu, 23 Sep 2021 18:54:06 -0300 Subject: [PATCH 3/5] correct flake and run format --- .../unit_tests/test_incremental_streams.py.hbs | 3 --- .../source-python-http-api/unit_tests/test_streams.py.hbs | 2 +- .../unit_tests/test_incremental_streams.py | 8 +++----- .../source-scaffold-source-http/unit_tests/test_source.py | 4 +++- .../unit_tests/test_streams.py | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs index 81348eee5045..94512d07630c 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs @@ -23,7 +23,6 @@ # from pytest import fixture -from unittest.mock import MagicMock from airbyte_cdk.models import SyncMode from source_{{snakeCase name}}.source import Incremental{{properCase name}}Stream @@ -46,7 +45,6 @@ def test_cursor_field(patch_incremental_base_class): def test_get_updated_state(patch_incremental_base_class): stream = Incremental{{properCase name}}Stream() - expected_cursor_field = [] # TODO: replace this with your input parameters inputs = {"current_stream_state": None, "latest_record": None} # TODO: replace this with your expected updated stream state @@ -56,7 +54,6 @@ def test_get_updated_state(patch_incremental_base_class): def test_stream_slices(patch_incremental_base_class): stream = Incremental{{properCase name}}Stream() - expected_cursor_field = [] # TODO: replace this with your input parameters inputs = {"sync_mode": SyncMode.incremental, "cursor_field": [], "stream_state": {}} # TODO: replace this with your expected stream slices list diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs index 2257856c63ef..9a23d1b742e5 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs @@ -70,7 +70,7 @@ def test_request_headers(patch_base_class): inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} # TODO: replace this with your expected request headers expected_headers = {} - assert stream.request_headers(**inputs) == {} + assert stream.request_headers(**inputs) == expected_headers def test_http_method(patch_base_class): diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py index 5504ef10cf92..f0b1df433532 100644 --- a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py @@ -22,10 +22,8 @@ # SOFTWARE. # -from pytest import fixture -from unittest.mock import MagicMock - from airbyte_cdk.models import SyncMode +from pytest import fixture from source_scaffold_source_http.source import IncrementalScaffoldSourceHttpStream @@ -46,7 +44,6 @@ def test_cursor_field(patch_incremental_base_class): def test_get_updated_state(patch_incremental_base_class): stream = IncrementalScaffoldSourceHttpStream() - expected_cursor_field = [] # TODO: replace this with your input parameters inputs = {"current_stream_state": None, "latest_record": None} # TODO: replace this with your expected updated stream state @@ -56,7 +53,6 @@ def test_get_updated_state(patch_incremental_base_class): def test_stream_slices(patch_incremental_base_class): stream = IncrementalScaffoldSourceHttpStream() - expected_cursor_field = [] # TODO: replace this with your input parameters inputs = {"sync_mode": SyncMode.incremental, "cursor_field": [], "stream_state": {}} # TODO: replace this with your expected stream slices list @@ -69,10 +65,12 @@ def test_supports_incremental(patch_incremental_base_class, mocker): stream = IncrementalScaffoldSourceHttpStream() assert stream.supports_incremental + def test_source_defined_cursor(patch_incremental_base_class): stream = IncrementalScaffoldSourceHttpStream() assert stream.source_defined_cursor + def test_stream_checkpoint_interval(patch_incremental_base_class): stream = IncrementalScaffoldSourceHttpStream() # TODO: replace this with your expected checkpoint interval diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py index d55d352e88a3..718e70a50e9a 100644 --- a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_source.py @@ -22,15 +22,17 @@ # SOFTWARE. # -from source_scaffold_source_http.source import SourceScaffoldSourceHttp from unittest.mock import MagicMock +from source_scaffold_source_http.source import SourceScaffoldSourceHttp + def test_check_connection(mocker): source = SourceScaffoldSourceHttp() logger_mock, config_mock = MagicMock(), MagicMock() assert source.check_connection(logger_mock, config_mock) == (True, None) + def test_streams(mocker): source = SourceScaffoldSourceHttp() config_mock = MagicMock() diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py index 86fa7e34f02e..1444c8c45a38 100644 --- a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_streams.py @@ -24,8 +24,8 @@ from http import HTTPStatus from unittest.mock import MagicMock -import pytest +import pytest from source_scaffold_source_http.source import ScaffoldSourceHttpStream @@ -70,7 +70,7 @@ def test_request_headers(patch_base_class): inputs = {"stream_slice": None, "stream_state": None, "next_page_token": None} # TODO: replace this with your expected request headers expected_headers = {} - assert stream.request_headers(**inputs) == {} + assert stream.request_headers(**inputs) == expected_headers def test_http_method(patch_base_class): From 92f03a3623438aafb5438f5da4345f328f44e999 Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Thu, 23 Sep 2021 20:47:35 -0300 Subject: [PATCH 4/5] format generator files --- .../unit_tests/test_incremental_streams.py.hbs | 2 ++ .../source-python-http-api/unit_tests/test_source.py.hbs | 1 + .../source-python-http-api/unit_tests/test_streams.py.hbs | 2 +- .../unit_tests/test_incremental_streams.py | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs index 94512d07630c..5b2c6bd8cc0f 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_incremental_streams.py.hbs @@ -66,10 +66,12 @@ def test_supports_incremental(patch_incremental_base_class, mocker): stream = Incremental{{properCase name}}Stream() assert stream.supports_incremental + def test_source_defined_cursor(patch_incremental_base_class): stream = Incremental{{properCase name}}Stream() assert stream.source_defined_cursor + def test_stream_checkpoint_interval(patch_incremental_base_class): stream = Incremental{{properCase name}}Stream() # TODO: replace this with your expected checkpoint interval diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs index d8459dadc939..48d165dbb79c 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs @@ -31,6 +31,7 @@ def test_check_connection(mocker): logger_mock, config_mock = MagicMock(), MagicMock() assert source.check_connection(logger_mock, config_mock) == (True, None) + def test_streams(mocker): source = Source{{properCase name}}() config_mock = MagicMock() diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs index 9a23d1b742e5..b86f0d3f0a07 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_streams.py.hbs @@ -24,8 +24,8 @@ from http import HTTPStatus from unittest.mock import MagicMock -import pytest +import pytest from source_{{snakeCase name}}.source import {{properCase name}}Stream diff --git a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py index f0b1df433532..5bb2c4081696 100644 --- a/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py +++ b/airbyte-integrations/connectors/source-scaffold-source-http/unit_tests/test_incremental_streams.py @@ -22,8 +22,9 @@ # SOFTWARE. # -from airbyte_cdk.models import SyncMode from pytest import fixture + +from airbyte_cdk.models import SyncMode from source_scaffold_source_http.source import IncrementalScaffoldSourceHttpStream From 9f0e44cd23bdb13e9f2c0fab4f472f3fcb28421a Mon Sep 17 00:00:00 2001 From: Marcos Marx Date: Thu, 23 Sep 2021 21:51:21 -0300 Subject: [PATCH 5/5] correct test_source scaffold gen --- .../source-python-http-api/unit_tests/test_source.py.hbs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs index 48d165dbb79c..253ff8d2e391 100644 --- a/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs +++ b/airbyte-integrations/connector-templates/source-python-http-api/unit_tests/test_source.py.hbs @@ -22,9 +22,10 @@ # SOFTWARE. # -from source_{{snakeCase name}}.source import Source{{properCase name}} from unittest.mock import MagicMock +from source_{{snakeCase name}}.source import Source{{properCase name}} + def test_check_connection(mocker): source = Source{{properCase name}}()