mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Expands automod view test
This commit is contained in:
parent
574c1db732
commit
7a9d320afd
2 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue