diff --git a/anvil_consortium_manager/auditor/tests/test_views.py b/anvil_consortium_manager/auditor/tests/test_views.py index a493fbdb..cd4db9d7 100644 --- a/anvil_consortium_manager/auditor/tests/test_views.py +++ b/anvil_consortium_manager/auditor/tests/test_views.py @@ -1452,6 +1452,27 @@ def test_post_blank_data_note(self): self.assertIn("required", form.errors["note"][0]) self.assertEqual(models.IgnoredManagedGroupMembership.objects.count(), 0) + def test_get_object_exists(self): + obj = factories.IgnoredManagedGroupMembershipFactory.create() + self.client.force_login(self.user) + response = self.client.get(self.get_url(obj.group.name, obj.ignored_email)) + self.assertRedirects(response, obj.get_absolute_url()) + + def test_post_object_exists(self): + obj = factories.IgnoredManagedGroupMembershipFactory.create() + self.client.force_login(self.user) + response = self.client.post( + self.get_url(obj.group.name, obj.ignored_email), + { + "group": obj.group.pk, + "ignored_email": obj.ignored_email, + "note": fake.sentence(), + }, + ) + self.assertRedirects(response, obj.get_absolute_url()) + self.assertEqual(models.IgnoredManagedGroupMembership.objects.count(), 1) + self.assertIn(obj, models.IgnoredManagedGroupMembership.objects.all()) + class IgnoredManagedGroupMembershipDeleteTest(TestCase): def setUp(self):