Expands automod view test

This commit is contained in:
Mouse Reeve 2022-07-06 10:52:50 -07:00
parent 574c1db732
commit 7a9d320afd
2 changed files with 6 additions and 2 deletions

View file

@ -53,6 +53,11 @@ class AutomodViews(TestCase):
request.user.is_superuser = True request.user.is_superuser = True
result = view(request) result = view(request)
self.assertIsInstance(result, TemplateResponse) self.assertIsInstance(result, TemplateResponse)
validate_html(result.render()) validate_html(result.render())
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
rule = models.AutoMod.objects.get()
self.assertTrue(rule.flag_users)
self.assertFalse(rule.flag_statuses)

View file

@ -33,8 +33,7 @@ class AutoMod(View):
def post(self, request): def post(self, request):
"""add rule""" """add rule"""
form = forms.AutoModRuleForm(request.POST) form = forms.AutoModRuleForm(request.POST)
success = form.is_valid() if form.is_valid():
if success:
form.save() form.save()
form = forms.AutoModRuleForm() form = forms.AutoModRuleForm()