Skip to content

Commit

Permalink
Add resync with parameters; lint
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Nov 25, 2024
1 parent 37a9390 commit 22bfe6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def start_sync(self, connector_id: str) -> None:
self._start_sync(request_fn=request_fn, connector_id=connector_id)

def start_resync(
self, connector_id: str, resync_parameters: Optional[Mapping[str, Sequence[str]]] = None
self, connector_id: str, resync_parameters: Optional[Mapping[str, Sequence[str]]] = None
) -> None:
"""Initiates a historical sync of all data for multiple schema tables within a Fivetran connector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,4 +473,10 @@ def all_api_mocks_fixture(
json=SAMPLE_SUCCESS_MESSAGE,
status=200,
)
fetch_workspace_data_api_mocks.add(
method=responses.POST,
url=f"{FIVETRAN_API_BASE}/{FIVETRAN_API_VERSION}/{FIVETRAN_CONNECTOR_ENDPOINT}/{connector_id}/schemas/tables/resync",
json=SAMPLE_SUCCESS_MESSAGE,
status=200,
)
yield fetch_workspace_data_api_mocks
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,10 @@ def test_basic_resource_request(
all_api_mocks.calls.reset()
client.start_resync(connector_id=connector_id, resync_parameters=None)
assert len(all_api_mocks.calls) == 3
assert f"{connector_id}/resync" in all_api_mocks.calls[2].request.url
assert f"{connector_id}/resync" in all_api_mocks.calls[2].request.url

# resync calls with parameters
all_api_mocks.calls.reset()
client.start_resync(connector_id=connector_id, resync_parameters={"property1": ["string"]})
assert len(all_api_mocks.calls) == 3
assert f"{connector_id}/schemas/tables/resync" in all_api_mocks.calls[2].request.url

0 comments on commit 22bfe6c

Please sign in to comment.