def test_register_existing(self):
     """Ensure that an existing user is redirected to login"""
     backend = RegistrationBackend()
     request = request_factory_login(self.factory)
     request.POST = QueryDict("name=Mudhoney&slug=mudhoney&[email protected]")
     self.assertEqual(302, backend.create_view(request).status_code)
 def test_register_authenticated(self):
     """Ensure an already authenticated user is redirected"""
     backend = RegistrationBackend()
     request = request_factory_login(self.factory, self.user)
     self.assertEqual(302, backend.create_view(request).status_code)
Ejemplo n.º 3
0
 def test_create_user(self):
     registered = RegistrationBackend().register_by_email("*****@*****.**")
     self.assertTrue(isinstance(registered, User))
     self.assertFalse(registered.is_active)
     self.assertEqual(1, len(mail.outbox))
     mail.outbox = []
Ejemplo n.º 4
0
 def test_register_existing(self):
     """Ensure that an existing user is redirected to login"""
     backend = RegistrationBackend()
     request = request_factory_login(self.factory)
     request.POST = QueryDict("name=Mudhoney&slug=mudhoney&[email protected]")
     self.assertEqual(302, backend.create_view(request).status_code)
Ejemplo n.º 5
0
 def test_register_authenticated(self):
     """Ensure an already authenticated user is redirected"""
     backend = RegistrationBackend()
     request = request_factory_login(self.factory, self.user)
     self.assertEqual(302, backend.create_view(request).status_code)
Ejemplo n.º 6
0
 def test_send_reminder(self):
     RegistrationBackend().send_reminder(self.pending_user)
     self.assertEqual(1, len(mail.outbox))
     RegistrationBackend().send_reminder(self.user)
     self.assertEqual(1, len(mail.outbox))  # User is active
     mail.outbox = []
Ejemplo n.º 7
0
 def test_create_existing_user(self):
     registered = RegistrationBackend().register_by_email(self.user.email)
     self.assertEqual(self.user, registered)
     self.assertEqual(0, len(mail.outbox))  # User is active