mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-09 08:45:28 +00:00
Updates reset password tests
This commit is contained in:
parent
3846b201bd
commit
b1f5171502
1 changed files with 18 additions and 3 deletions
|
@ -104,7 +104,9 @@ class PasswordViews(TestCase):
|
|||
"""reset from code"""
|
||||
view = views.PasswordReset.as_view()
|
||||
code = models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "hi", "confirm-password": "hi"})
|
||||
request = self.factory.post(
|
||||
"", {"password": "longwordsecure", "confirm_password": "longwordsecure"}
|
||||
)
|
||||
with patch("bookwyrm.views.landing.password.login"):
|
||||
resp = view(request, code.code)
|
||||
self.assertEqual(resp.status_code, 302)
|
||||
|
@ -114,7 +116,9 @@ class PasswordViews(TestCase):
|
|||
"""reset from code"""
|
||||
view = views.PasswordReset.as_view()
|
||||
models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "hi", "confirm-password": "hi"})
|
||||
request = self.factory.post(
|
||||
"", {"password": "longwordsecure", "confirm_password": "longwordsecure"}
|
||||
)
|
||||
resp = view(request, "jhgdkfjgdf")
|
||||
validate_html(resp.render())
|
||||
self.assertTrue(models.PasswordReset.objects.exists())
|
||||
|
@ -123,7 +127,18 @@ class PasswordViews(TestCase):
|
|||
"""reset from code"""
|
||||
view = views.PasswordReset.as_view()
|
||||
code = models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "hi", "confirm-password": "hihi"})
|
||||
request = self.factory.post(
|
||||
"", {"password": "longwordsecure", "confirm_password": "hihi"}
|
||||
)
|
||||
resp = view(request, code.code)
|
||||
validate_html(resp.render())
|
||||
self.assertTrue(models.PasswordReset.objects.exists())
|
||||
|
||||
def test_password_reset_invalid(self):
|
||||
"""reset from code"""
|
||||
view = views.PasswordReset.as_view()
|
||||
code = models.PasswordReset.objects.create(user=self.local_user)
|
||||
request = self.factory.post("", {"password": "a", "confirm_password": "a"})
|
||||
resp = view(request, code.code)
|
||||
validate_html(resp.render())
|
||||
self.assertTrue(models.PasswordReset.objects.exists())
|
||||
|
|
Loading…
Reference in a new issue