Skip to content

Commit

Permalink
Improve coverage for auditor app
Browse files Browse the repository at this point in the history
  • Loading branch information
amstilp committed Dec 19, 2024
1 parent 593d9ee commit c190299
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions anvil_consortium_manager/auditor/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c190299

Please sign in to comment.