-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source Azure Blob Storage: add unit tests (#37467)
Signed-off-by: Artem Inzhyyants <[email protected]>
- Loading branch information
Showing
18 changed files
with
793 additions
and
486 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
2 changes: 1 addition & 1 deletion
2
airbyte-integrations/connectors/source-azure-blob-storage/integration_tests/spec.json
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
957 changes: 585 additions & 372 deletions
957
airbyte-integrations/connectors/source-azure-blob-storage/poetry.lock
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",] | |
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry] | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
name = "source-azure-blob-storage" | ||
description = "Source implementation for Azure Blob Storage." | ||
authors = [ "Airbyte <[email protected]>",] | ||
|
@@ -28,6 +28,7 @@ source-azure-blob-storage = "source_azure_blob_storage.run:run" | |
|
||
[tool.poetry.group.dev.dependencies] | ||
docker = "^7.0.0" | ||
freezegun = "^1.4.0" | ||
pytest-mock = "^3.6.1" | ||
requests-mock = "^1.9.3" | ||
pandas = "2.2.1" | ||
|
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
31 changes: 0 additions & 31 deletions
31
...nnectors/source-azure-blob-storage/source_azure_blob_storage/legacy_config_transformer.py
This file was deleted.
Oops, something went wrong.
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
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
27 changes: 27 additions & 0 deletions
27
airbyte-integrations/connectors/source-azure-blob-storage/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,27 @@ | ||
# Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
|
||
|
||
from azure.core.credentials import AccessToken | ||
from source_azure_blob_storage.stream_reader import AzureOauth2Authenticator | ||
|
||
|
||
def test_custom_authenticator(requests_mock): | ||
|
||
authenticator = AzureOauth2Authenticator( | ||
token_refresh_endpoint="https://login.microsoftonline.com/tenant_id/oauth2/v2.0/token", | ||
client_id="client_id", | ||
client_secret="client_secret", | ||
refresh_token="refresh_token", | ||
) | ||
token_refresh_response = { | ||
"token_type": "Bearer", | ||
"scope": "https://storage.azure.com/user_impersonation https://storage.azure.com/.default", | ||
"expires_in": 5144, | ||
"ext_expires_in": 5144, | ||
"access_token": "access_token", | ||
"refresh_token": "refresh_token" | ||
} | ||
requests_mock.post("https://login.microsoftonline.com/tenant_id/oauth2/v2.0/token", json=token_refresh_response) | ||
new_token = authenticator.get_token() | ||
assert isinstance(new_token, AccessToken) | ||
assert new_token.token == "access_token" |
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
9 changes: 9 additions & 0 deletions
9
...ions/connectors/source-azure-blob-storage/unit_tests/test_configs/test_legacy_config.json
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,9 @@ | ||
{ | ||
"azure_blob_storage_endpoint": "https://airbyteteststorage.blob.core.windows.net", | ||
"azure_blob_storage_account_name": "airbyteteststorage", | ||
"azure_blob_storage_account_key": "secret/key==", | ||
"azure_blob_storage_container_name": "airbyte-source-azure-blob-storage-test", | ||
"azure_blob_storage_blobs_prefix": "subfolder/", | ||
"azure_blob_storage_schema_inference_limit": 500, | ||
"format": "jsonl" | ||
} |
Oops, something went wrong.