From b891f32707c4e46afc423f6df20de115eb6102d0 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 8 Sep 2021 16:31:15 -0700 Subject: [PATCH] Adds deletion test --- bookwyrm/tests/views/test_email_blocks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bookwyrm/tests/views/test_email_blocks.py b/bookwyrm/tests/views/test_email_blocks.py index 1272ef9d..1fddfbe7 100644 --- a/bookwyrm/tests/views/test_email_blocks.py +++ b/bookwyrm/tests/views/test_email_blocks.py @@ -55,3 +55,21 @@ class EmailBlocklistViews(TestCase): self.assertTrue( models.EmailBlocklist.objects.filter(domain="gmail.com").exists() ) + + def test_blocklist_page_delete(self): + """there are so many views, this just makes sure it LOADS""" + domain = models.EmailBlocklist.objects.create(domain="gmail.com") + + view = views.EmailBlocklist.as_view() + request = self.factory.post(f"/settings/email-blocklist/{domain.id}/delete") + request.user = self.local_user + request.user.is_superuser = True + + result = view(request) + + self.assertIsInstance(result, TemplateResponse) + self.assertEqual(result.status_code, 302) + + self.assertFalse( + models.EmailBlocklist.objects.filter(domain="gmail.com").exists() + )