Skip to content

Commit

Permalink
CAT: fixed TestSpec.test_oauth_is_default_method to skip connector sp…
Browse files Browse the repository at this point in the history
…ec without predicate key (airbytehq#34559)
  • Loading branch information
darynaishchenko authored and jatinyadav-cc committed Feb 26, 2024
1 parent f8ca22b commit 123d2e4
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 3.3.1
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "connector-acceptance-test"
version = "3.2.0"
version = "3.3.1"
description = "Contains acceptance tests for connectors."
authors = ["Airbyte <contact@airbyte.io>"]
license = "MIT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 123d2e4

Please sign in to comment.