mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-09-28 22:32:01 +00:00
Fixes unit test
This commit is contained in:
parent
cc3cd5c98c
commit
dd83e32f32
1 changed files with 5 additions and 2 deletions
|
@ -11,6 +11,7 @@ from bookwyrm import emailing, models
|
||||||
class Emailing(TestCase):
|
class Emailing(TestCase):
|
||||||
"""every response to a get request, html or json"""
|
"""every response to a get request, html or json"""
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
"""we need basic test data and mocks"""
|
"""we need basic test data and mocks"""
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
|
@ -41,10 +42,12 @@ class Emailing(TestCase):
|
||||||
self.assertEqual(args[1], "You're invited to join BookWyrm!")
|
self.assertEqual(args[1], "You're invited to join BookWyrm!")
|
||||||
self.assertEqual(len(args), 4)
|
self.assertEqual(len(args), 4)
|
||||||
|
|
||||||
def test_password_reset_email(self, email_mock):
|
def test_password_reset_email(self, _):
|
||||||
"""load the password reset email"""
|
"""load the password reset email"""
|
||||||
reset = models.PasswordReset.objects.create(user=self.local_user)
|
reset = models.PasswordReset.objects.create(user=self.local_user)
|
||||||
emailing.password_reset_email(reset)
|
|
||||||
|
with patch("bookwyrm.emailing.send_email") as email_mock:
|
||||||
|
emailing.password_reset_email(reset)
|
||||||
|
|
||||||
self.assertEqual(email_mock.call_count, 1)
|
self.assertEqual(email_mock.call_count, 1)
|
||||||
args = email_mock.call_args[0]
|
args = email_mock.call_args[0]
|
||||||
|
|
Loading…
Reference in a new issue