Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Dec 19, 2024
1 parent dc5468d commit 0f39290
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@ def get_job_details(self, job_id: int) -> Mapping[str, Any]:
)

def cancel_job(self, job_id: int) -> Mapping[str, Any]:
return self.make_request(method="DELETE", endpoint=f"jobs/{job_id}")
return self._make_request(
method="DELETE", endpoint=f"jobs/{job_id}", base_url=self.rest_api_base_url
)


@experimental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,10 @@ def all_api_mocks_fixture(
json=SAMPLE_JOB_RESPONSE,
status=200,
)
fetch_workspace_data_api_mocks.add(
method=responses.DELETE,
url=f"{AIRBYTE_REST_API_BASE}/{AIRBYTE_REST_API_VERSION}/jobs/{TEST_JOB_ID}",
json=SAMPLE_JOB_RESPONSE,
status=200,
)
yield fetch_workspace_data_api_mocks
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ def test_basic_resource_request(
client.get_destination_details(destination_id=TEST_DESTINATION_ID)
client.start_sync_job(connection_id=TEST_CONNECTION_ID)
client.get_job_details(job_id=TEST_JOB_ID)
client.cancel_job(job_id=TEST_JOB_ID)

assert len(all_api_mocks.calls) == 6
assert len(all_api_mocks.calls) == 7
# The first call is to create the access token
api_calls = assert_token_call_and_split_calls(calls=all_api_mocks.calls)
# The next calls are actual API calls
Expand All @@ -142,3 +143,4 @@ def test_basic_resource_request(
assert_rest_api_call(call=api_calls[2], endpoint=f"destinations/{TEST_DESTINATION_ID}")
assert_rest_api_call(call=api_calls[3], endpoint="jobs", object_id=TEST_CONNECTION_ID)
assert_rest_api_call(call=api_calls[4], endpoint=f"jobs/{TEST_JOB_ID}")
assert_rest_api_call(call=api_calls[5], endpoint=f"jobs/{TEST_JOB_ID}")

0 comments on commit 0f39290

Please sign in to comment.