Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tests using has_calls instead of assert_has_calls #3775

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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