Example #1
0
 def test_can_properly_handle_an_invalid_username(self):
     # Setup
     User.objects.create_user(
         username='******', email='*****@*****.**', password='******')
     backend = EmailBackend()
     # Run & check
     self.assertIsNone(backend.authenticate(username='******', password='******'))
Example #2
0
 def test_can_authenticate_a_user_using_his_username(self):
     # Setup
     user = User.objects.create_user(
         username='******', email='*****@*****.**', password='******')
     backend = EmailBackend()
     # Run & check
     self.assertEqual(
         backend.authenticate(username='******', password='******'), user)
Example #3
0
 def test_can_properly_handle_an_invalid_username(self):
     # Setup
     User.objects.create_user(username='******',
                              email='*****@*****.**',
                              password='******')
     backend = EmailBackend()
     # Run & check
     self.assertIsNone(
         backend.authenticate(username='******', password='******'))
Example #4
0
 def test_can_properly_handle_multiple_users_with_the_same_email_address(self):
     # Setup
     User.objects.create_user(
         username='******', email='*****@*****.**', password='******')
     User.objects.create_user(
         username='******', email='*****@*****.**', password='******')
     backend = EmailBackend()
     # Run & check
     self.assertIsNone(
         backend.authenticate(username='******', password='******'))
Example #5
0
 def test_can_authenticate_a_user_using_his_email_address(self):
     # Setup
     user = User.objects.create_user(username='******',
                                     email='*****@*****.**',
                                     password='******')
     backend = EmailBackend()
     # Run & check
     self.assertEqual(
         backend.authenticate(username='******',
                              password='******'), user)
Example #6
0
 def test_can_properly_handle_multiple_users_with_the_same_email_address(
         self):
     # Setup
     User.objects.create_user(username='******',
                              email='*****@*****.**',
                              password='******')
     User.objects.create_user(username='******',
                              email='*****@*****.**',
                              password='******')
     backend = EmailBackend()
     # Run & check
     self.assertIsNone(
         backend.authenticate(username='******',
                              password='******'))