Пример #1
0
    def test_returns_none_if_password_does_not_match(self):
        travis = generate_email_only_user()
        auth = EmailOnlyBackend()
        user = auth.authenticate(username='******', password='******')

        self.assertEqual(None, user)
        travis.delete()
Пример #2
0
    def test_returns_user_if_found(self):
        travis = generate_email_only_user()
        auth = EmailOnlyBackend()
        user = auth.authenticate(username = '******', password='******')

        self.assert_(isinstance(user, User))
        self.assertEqual(user, travis)

        travis.delete()
Пример #3
0
 def test_falls_back_on_real_username_if_email_not_found(self):
     chris = generate_username_only_user()
     auth = EmailOnlyBackend()
     user = auth.authenticate(username='******', password='******')
     self.assertEqual(user, chris)
Пример #4
0
 def test_returns_none_if_user_not_found(self):
     auth = EmailOnlyBackend()
     self.assertEqual(None, auth.authenticate(username='******', password='******'))
Пример #5
0
 def test_returns_none_if_no_password_is_provided(self):
     auth = EmailOnlyBackend()
     self.assertEqual(None, auth.authenticate(username='******'))
Пример #6
0
 def test_returns_none_if_nothing_provided(self):
     auth = EmailOnlyBackend()
     self.assertEqual(None, auth.authenticate())