From 3118cdfbb6f262d15d49d7879dc61323084d821c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 16 Oct 2021 10:56:22 -0700 Subject: [PATCH] Adds another register test --- bookwyrm/tests/views/test_register.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bookwyrm/tests/views/test_register.py b/bookwyrm/tests/views/test_register.py index 133b56423..c5138a81a 100644 --- a/bookwyrm/tests/views/test_register.py +++ b/bookwyrm/tests/views/test_register.py @@ -121,6 +121,18 @@ class RegisterViews(TestCase): self.assertEqual(models.User.objects.count(), 1) validate_html(response.render()) + def test_register_username_in_use(self, *_): + """that username is taken""" + view = views.Register.as_view() + self.assertEqual(models.User.objects.count(), 1) + request = self.factory.post( + "register/", + {"localname": "mouse", "password": "mouseword", "email": "aa@bb.ccc"}, + ) + response = view(request) + self.assertEqual(models.User.objects.count(), 1) + validate_html(response.render()) + def test_register_invalid_username(self, *_): """gotta have an email""" view = views.Register.as_view()