Skip to content

Commit

Permalink
address change request
Browse files Browse the repository at this point in the history
  • Loading branch information
florinbilt committed Nov 19, 2024
1 parent e4cb1c2 commit af4cc78
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/webapp/api/test_performance_alertsummary_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,36 +241,33 @@ def test_alert_summaries_put(


def test_performance_alert_summary_change_revision(
client, test_repository, test_perf_signature, test_perf_alert_summary, test_user, test_sheriff):

client, test_perf_alert_summary, test_sheriff, test_push
):
# verify we can set revision
client.force_authenticate(user=test_sheriff)
resp = client.put(
reverse("performance-alert-summaries-list") + "1/",
{"revision": "b11529c9865a4dee3a93d63d119ebb89fcbbdf69"},
{"revision": test_push.revision},
)
assert resp.status_code == 200
assert PerformanceAlertSummary.objects.get(id=1).push.revision == test_push.revision

obj = PerformanceAlertSummary.objects.get(id=1)
assert str(getattr(obj, "push")).split()[-1] == "b11529c9865a4dee3a93d63d119ebb89fcbbdf69"

# verify we can set inexistent revision
client.force_authenticate(user=test_sheriff)
# verify we can set non-exist revision
resp = client.put(
reverse("performance-alert-summaries-list") + "1/",
{"revision": "no-push-revision"},
)
assert resp.status_code == 400

# revert revision
original_revision = str((getattr(obj, "original_push"))).split()[-1]
client.force_authenticate(user=test_sheriff)
original_revision = PerformanceAlertSummary.objects.get(id=1).original_push.revision
resp = client.put(
reverse("performance-alert-summaries-list") + "1/",
{"revision": original_revision},
)
assert resp.status_code == 200
assert str(getattr(obj, "push")).split()[-1] == original_revision
assert PerformanceAlertSummary.objects.get(id=1).push.revision == original_revision


def test_auth_for_alert_summary_post(
client,
Expand Down

0 comments on commit af4cc78

Please sign in to comment.