mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 21:11:16 +00:00
Updates tests
This commit is contained in:
parent
da19089d34
commit
35cb3fa8fc
3 changed files with 18 additions and 11 deletions
|
@ -3,8 +3,8 @@
|
|||
{% load bookwyrm_tags %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}{{ username }}{% endblock %}
|
||||
{% block header %}{{ username }}{% endblock %}
|
||||
{% block title %}{{ user.username }}{% endblock %}
|
||||
{% block header %}{{ user.username }}{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
<div class="block">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
""" test for app action functionality """
|
||||
from unittest.mock import patch
|
||||
from django.template.response import TemplateResponse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
@ -115,22 +114,19 @@ class ReportViews(TestCase):
|
|||
report.refresh_from_db()
|
||||
self.assertFalse(report.resolved)
|
||||
|
||||
def test_deactivate_user(self):
|
||||
def test_suspend_user(self):
|
||||
""" toggle whether a user is able to log in """
|
||||
self.assertTrue(self.rat.is_active)
|
||||
report = models.Report.objects.create(reporter=self.local_user, user=self.rat)
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
request.user.is_superuser = True
|
||||
|
||||
# de-activate
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
views.deactivate_user(request, report.id)
|
||||
views.suspend_user(request, self.local_user.id)
|
||||
self.rat.refresh_from_db()
|
||||
self.assertFalse(self.rat.is_active)
|
||||
|
||||
# re-activate
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
views.deactivate_user(request, report.id)
|
||||
views.suspend_user(request, self.local_user.id)
|
||||
self.rat.refresh_from_db()
|
||||
self.assertTrue(self.rat.is_active)
|
||||
|
|
|
@ -21,9 +21,9 @@ class UserAdminViews(TestCase):
|
|||
)
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
def test_user_admin_page(self):
|
||||
def test_user_admin_list_page(self):
|
||||
""" there are so many views, this just makes sure it LOADS """
|
||||
view = views.UserAdmin.as_view()
|
||||
view = views.UserAdminList.as_view()
|
||||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
request.user.is_superuser = True
|
||||
|
@ -31,3 +31,14 @@ class UserAdminViews(TestCase):
|
|||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_user_admin_page(self):
|
||||
""" there are so many views, this just makes sure it LOADS """
|
||||
view = views.UserAdmin.as_view()
|
||||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
request.user.is_superuser = True
|
||||
result = view(request, self.local_user)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
result.render()
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
|
Loading…
Reference in a new issue