From 459728ec680903bb19c37d9afbc85bc72462d7f5 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Wed, 15 Nov 2023 14:27:40 +0100 Subject: [PATCH] Add tests for accessing non existent profile --- tests/integration/web/alertprofiles_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/integration/web/alertprofiles_test.py b/tests/integration/web/alertprofiles_test.py index ee04d388dc..00d67cfa0d 100644 --- a/tests/integration/web/alertprofiles_test.py +++ b/tests/integration/web/alertprofiles_test.py @@ -59,6 +59,18 @@ def test_profile_with_nonascii_name_should_be_saved(self, db, admin_account): assert set_active_profile(request, profile) is None + def test_show_non_existent_profile(self, db, client): + last_alert_profile_id = getattr(AlertProfile.objects.last(), "pk", 0) + response = client.get( + path=reverse( + 'alertprofiles-profile-detail', args=(last_alert_profile_id + 1,) + ), + follow=True, + ) + + assert response.status_code == 200 + assert "The requested profile does not exist." in smart_str(response.content) + def test_alertprofiles_save_profile(self, db, client): url = reverse('alertprofiles-profile-save') profile_name = 'Catch 22'