-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4892e8
commit f4fa792
Showing
2 changed files
with
42 additions
and
47 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
27 changes: 13 additions & 14 deletions
27
..._modules/libraries/dagster-fivetran/dagster_fivetran_tests/experimental/test_resources.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 |
---|---|---|
@@ -1,28 +1,27 @@ | ||
import uuid | ||
from typing import Callable | ||
import responses | ||
|
||
from dagster_fivetran import FivetranWorkspace | ||
|
||
|
||
def test_basic_resource_request( | ||
connector_id: str, destination_id: str, group_id: str, workspace_data_api_mocks_fn: Callable | ||
connector_id: str, destination_id: str, group_id: str, workspace_data_api_mocks: responses.RequestsMock | ||
) -> None: | ||
api_key = uuid.uuid4().hex | ||
api_secret = uuid.uuid4().hex | ||
|
||
resource = FivetranWorkspace(api_key=api_key, api_secret=api_secret) | ||
|
||
with workspace_data_api_mocks_fn() as response: | ||
client = resource.get_client() | ||
client.get_connector_details(connector_id=connector_id) | ||
client.get_connectors_for_group(group_id=group_id) | ||
client.get_destination_details(destination_id=destination_id) | ||
client.get_groups() | ||
client = resource.get_client() | ||
client.get_connector_details(connector_id=connector_id) | ||
client.get_connectors_for_group(group_id=group_id) | ||
client.get_destination_details(destination_id=destination_id) | ||
client.get_groups() | ||
|
||
assert len(response.calls) == 4 | ||
assert len(workspace_data_api_mocks.calls) == 4 | ||
|
||
assert "Basic" in response.calls[0].request.headers["Authorization"] | ||
assert connector_id in response.calls[0].request.url | ||
assert group_id in response.calls[1].request.url | ||
assert destination_id in response.calls[2].request.url | ||
assert "groups" in response.calls[3].request.url | ||
assert "Basic" in workspace_data_api_mocks.calls[0].request.headers["Authorization"] | ||
assert connector_id in workspace_data_api_mocks.calls[0].request.url | ||
assert group_id in workspace_data_api_mocks.calls[1].request.url | ||
assert destination_id in workspace_data_api_mocks.calls[2].request.url | ||
assert "groups" in workspace_data_api_mocks.calls[3].request.url |