Skip to content

Commit

Permalink
fix: tests using has_calls instead of assert_has_calls (#3775)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell authored Apr 16, 2024
1 parent 37312b2 commit b019a35
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion api/tests/unit/features/test_unit_features_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_feature_state_webhook_triggered_when_feature_deleted(
mock_calls = [
mock.call(fs, WebhookEventType.FLAG_DELETED) for fs in feature_states
]
mocked_trigger_fs_change_webhook.has_calls(mock_calls)
mocked_trigger_fs_change_webhook.assert_has_calls(mock_calls)

def test_remove_owners_only_remove_specified_owners(self):
# Given
Expand Down
37 changes: 20 additions & 17 deletions api/tests/unit/sse/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,26 @@ def test_send_environment_update_message_for_project_make_correct_request(
send_environment_update_message_for_project(realtime_enabled_project.id)

# Then
mocked_requests.post.has_calls(
mocker.call(
f"{base_url}/sse/environments/{realtime_enabled_project_environment_one.api_key}/queue-change",
headers={"Authorization": f"Token {token}"},
json={
"updated_at": realtime_enabled_project_environment_one.updated_at.isoformat()
},
timeout=2,
),
mocker.call(
f"{base_url}/sse/environments/{realtime_enabled_project_environment_two.api_key}/queue-change",
headers={"Authorization": f"Token {token}"},
json={
"updated_at": realtime_enabled_project_environment_two.updated_at.isoformat()
},
timeout=2,
),
mocked_requests.post.assert_has_calls(
calls=[
mocker.call(
f"{base_url}/sse/environments/{realtime_enabled_project_environment_one.api_key}/queue-change",
headers={"Authorization": f"Token {token}"},
json={
"updated_at": realtime_enabled_project_environment_one.updated_at.isoformat()
},
timeout=2,
),
mocker.call(
f"{base_url}/sse/environments/{realtime_enabled_project_environment_two.api_key}/queue-change",
headers={"Authorization": f"Token {token}"},
json={
"updated_at": realtime_enabled_project_environment_two.updated_at.isoformat()
},
timeout=2,
),
],
any_order=True,
)


Expand Down

0 comments on commit b019a35

Please sign in to comment.