From 87c10871a871272a871efc5a51cc388ff9bc6535 Mon Sep 17 00:00:00 2001 From: darynaishchenko Date: Fri, 26 Jan 2024 17:43:14 +0200 Subject: [PATCH 1/2] fixed test_oauth_is_default_method to skipp connector spec whithout predicate key --- .../connector-acceptance-test/CHANGELOG.md | 3 + .../tests/test_core.py | 2 + .../connector-acceptance-test/pyproject.toml | 2 +- .../unit_tests/test_spec.py | 55 +++++++++++++++++++ 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md b/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md index b2a1d396b30cc..961a19f1189ea 100644 --- a/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md +++ b/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 3.2.1 +Fix TestSpec.test_oauth_is_default_method to skipp connectors that doesn't have predicate_key object. + ## 3.2.0 Add TestBasicRead.test_all_supported_file_types_present, which validates that all supported file types are present in the sandbox account for certified file-based connectors. diff --git a/airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/tests/test_core.py b/airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/tests/test_core.py index 9e20ecc14f91f..e9ec6123b4726 100644 --- a/airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/tests/test_core.py +++ b/airbyte-integrations/bases/connector-acceptance-test/connector_acceptance_test/tests/test_core.py @@ -538,6 +538,8 @@ def test_oauth_is_default_method(self, skip_oauth_default_method_test: bool, act advanced_auth = actual_connector_spec.advanced_auth if not advanced_auth: pytest.skip("Source does not have OAuth method.") + if not advanced_auth.predicate_key: + pytest.skip("Advanced Auth object does not have predicate_key, only one option to authenticate.") spec_schema = actual_connector_spec.connectionSpecification credentials = advanced_auth.predicate_key[0] diff --git a/airbyte-integrations/bases/connector-acceptance-test/pyproject.toml b/airbyte-integrations/bases/connector-acceptance-test/pyproject.toml index 7be03c21d32dc..7b056ff4439b3 100644 --- a/airbyte-integrations/bases/connector-acceptance-test/pyproject.toml +++ b/airbyte-integrations/bases/connector-acceptance-test/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "connector-acceptance-test" -version = "3.2.0" +version = "3.2.1" description = "Contains acceptance tests for connectors." authors = ["Airbyte "] license = "MIT" diff --git a/airbyte-integrations/bases/connector-acceptance-test/unit_tests/test_spec.py b/airbyte-integrations/bases/connector-acceptance-test/unit_tests/test_spec.py index e4651b2004043..4b4b1d456e756 100644 --- a/airbyte-integrations/bases/connector-acceptance-test/unit_tests/test_spec.py +++ b/airbyte-integrations/bases/connector-acceptance-test/unit_tests/test_spec.py @@ -990,6 +990,61 @@ def test_validate_oauth_flow(connector_spec, expected_error): ), "Credentials object does not have oneOf option.", ), + # SUCCESS: Skipped: no predicate key. + ( + ConnectorSpecification( + connectionSpecification={ + "type": "object", + "properties": { + "api_url": {"type": "object"}, + "credentials": { + "type": "object", + "properties": { + "auth_type": {"type": "string", "const": "oauth2.0"}, + "client_id": {"type": "string"}, + "client_secret": {"type": "string"}, + "access_token": {"type": "string"}, + "refresh_token": {"type": "string"}, + "token_expiry_date": {"type": "string", "format": "date-time"}, + }, + }, + }, + }, + advanced_auth={ + "auth_flow_type": "oauth2.0", + "oauth_config_specification": { + "oauth_user_input_from_connector_config_specification": { + "type": "object", + "properties": {"domain": {"type": "string", "path_in_connector_config": ["api_url"]}}, + }, + "complete_oauth_output_specification": { + "type": "object", + "properties": { + "access_token": {"type": "string", "path_in_connector_config": ["credentials", "access_token"]}, + "refresh_token": {"type": "string", "path_in_connector_config": ["credentials", "refresh_token"]}, + "token_expiry_date": { + "type": "string", + "format": "date-time", + "path_in_connector_config": ["credentials", "token_expiry_date"], + }, + }, + }, + "complete_oauth_server_input_specification": { + "type": "object", + "properties": {"client_id": {"type": "string"}, "client_secret": {"type": "string"}}, + }, + "complete_oauth_server_output_specification": { + "type": "object", + "properties": { + "client_id": {"type": "string", "path_in_connector_config": ["credentials", "client_id"]}, + "client_secret": {"type": "string", "path_in_connector_config": ["credentials", "client_secret"]}, + }, + }, + }, + }, + ), + "Advanced Auth object does not have predicate_key, only one option to authenticate.", + ) ] ) def test_validate_auth_default_method(connector_spec, expected_error): From e8e0ad8a01281a27ce94a30a700ed15acc188450 Mon Sep 17 00:00:00 2001 From: darynaishchenko Date: Fri, 26 Jan 2024 17:50:46 +0200 Subject: [PATCH 2/2] updated changelog --- .../bases/connector-acceptance-test/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md b/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md index d825f19559bbf..4aa3ba5ea0228 100644 --- a/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md +++ b/airbyte-integrations/bases/connector-acceptance-test/CHANGELOG.md @@ -1,7 +1,7 @@ # Changelog ## 3.3.1 -Fix TestSpec.test_oauth_is_default_method to skipp connectors that doesn't have predicate_key object. +Fix TestSpec.test_oauth_is_default_method to skip connectors that doesn't have predicate_key object. ## 3.3.0 Add `test_certified_connector_has_allowed_hosts` and `test_certified_connector_has_suggested_streams` tests to the `connector_attribute` test suite