forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Source Typeform: 499 handling (airbytehq#32775)
Co-authored-by: darynaishchenko <darynaishchenko@users.noreply.github.com>
- Loading branch information
1 parent
af7a9bc
commit 609be9e
Showing
4 changed files
with
59 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
airbyte-integrations/connectors/source-typeform/unit_tests/test_authenticator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
|
||
from airbyte_cdk.sources.declarative.auth.oauth import DeclarativeSingleUseRefreshTokenOauth2Authenticator | ||
from airbyte_cdk.sources.declarative.auth.token import BearerAuthenticator | ||
from source_typeform.components import TypeformAuthenticator | ||
|
||
|
||
def test_typeform_authenticator(): | ||
config = {"credentials": {"access_token": "access_token", "client_id": None, "client_secret": None}} | ||
oauth_config = {"credentials": {"access_token": None, "client_id": "client_id", "client_secret": "client_secret"}} | ||
|
||
class TokenProvider: | ||
def get_token(self) -> str: | ||
return "test token" | ||
|
||
auth = TypeformAuthenticator( | ||
token_auth=BearerAuthenticator(config=config, token_provider=TokenProvider(), parameters={}), | ||
config=config, | ||
oauth2=DeclarativeSingleUseRefreshTokenOauth2Authenticator(connector_config=config, token_refresh_endpoint="/new_token") | ||
) | ||
assert isinstance(auth, BearerAuthenticator) | ||
|
||
oauth = TypeformAuthenticator( | ||
token_auth=BearerAuthenticator(config=oauth_config, token_provider=TokenProvider(), parameters={}), | ||
config=oauth_config, | ||
oauth2=DeclarativeSingleUseRefreshTokenOauth2Authenticator(connector_config=oauth_config, token_refresh_endpoint="/new_token") | ||
) | ||
assert isinstance(oauth, DeclarativeSingleUseRefreshTokenOauth2Authenticator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters