forked from mirrors/bookwyrm
Edit user test mocks
This commit is contained in:
parent
c23f341980
commit
5d2324a4a0
2 changed files with 15 additions and 14 deletions
|
@ -15,6 +15,7 @@ from django.test.client import RequestFactory
|
|||
from bookwyrm import forms, models, views
|
||||
|
||||
|
||||
@patch("bookwyrm.suggested_users.remove_user_task.delay")
|
||||
class EditUserViews(TestCase):
|
||||
"""view user and edit profile"""
|
||||
|
||||
|
@ -45,7 +46,7 @@ class EditUserViews(TestCase):
|
|||
self.anonymous_user = AnonymousUser
|
||||
self.anonymous_user.is_authenticated = False
|
||||
|
||||
def test_edit_user_page(self):
|
||||
def test_edit_user_page(self, _):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.EditUser.as_view()
|
||||
request = self.factory.get("")
|
||||
|
@ -55,7 +56,7 @@ class EditUserViews(TestCase):
|
|||
result.render()
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_edit_user(self):
|
||||
def test_edit_user(self, _):
|
||||
"""use a form to update a user"""
|
||||
view = views.EditUser.as_view()
|
||||
form = forms.EditUserForm(instance=self.local_user)
|
||||
|
@ -74,7 +75,7 @@ class EditUserViews(TestCase):
|
|||
self.assertEqual(self.local_user.name, "New Name")
|
||||
self.assertEqual(self.local_user.email, "wow@email.com")
|
||||
|
||||
def test_edit_user_avatar(self):
|
||||
def test_edit_user_avatar(self, _):
|
||||
"""use a form to update a user"""
|
||||
view = views.EditUser.as_view()
|
||||
form = forms.EditUserForm(instance=self.local_user)
|
||||
|
@ -101,7 +102,7 @@ class EditUserViews(TestCase):
|
|||
self.assertEqual(self.local_user.avatar.width, 120)
|
||||
self.assertEqual(self.local_user.avatar.height, 120)
|
||||
|
||||
def test_crop_avatar(self):
|
||||
def test_crop_avatar(self, _):
|
||||
"""reduce that image size"""
|
||||
image_file = pathlib.Path(__file__).parent.joinpath(
|
||||
"../../static/images/no_cover.jpg"
|
||||
|
@ -113,7 +114,7 @@ class EditUserViews(TestCase):
|
|||
image_result = Image.open(result)
|
||||
self.assertEqual(image_result.size, (120, 120))
|
||||
|
||||
def test_delete_user_page(self):
|
||||
def test_delete_user_page(self, _):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.DeleteUser.as_view()
|
||||
request = self.factory.get("")
|
||||
|
@ -124,7 +125,7 @@ class EditUserViews(TestCase):
|
|||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task")
|
||||
def test_delete_user(self, _):
|
||||
def test_delete_user(self, *_):
|
||||
"""use a form to update a user"""
|
||||
view = views.DeleteUser.as_view()
|
||||
form = forms.DeleteUserForm()
|
||||
|
|
|
@ -163,7 +163,7 @@ class FederationViews(TestCase):
|
|||
"""load a json file with a list of servers to block"""
|
||||
server = models.FederatedServer.objects.create(server_name="hi.there.com")
|
||||
self.remote_user.federated_server = server
|
||||
self.remote_user.save()
|
||||
self.remote_user.save(update_fields=["federated_server"])
|
||||
|
||||
data = [
|
||||
{"instance": "server.name", "url": "https://explanation.url"}, # new server
|
||||
|
|
Loading…
Reference in a new issue