class EmailBackendTest(TestCase): def setUp(self): UserModel = get_user_model() UserModel.objects.create_user( username='******', email='*****@*****.**', password='******' ) self.backend = EmailBackend() def test_authenticate_with_email(self): user = self.backend.authenticate( email='*****@*****.**', password='******' ) self.assertIsNotNone(user) def test_wrong_password(self): user = self.backend.authenticate(email='*****@*****.**', password='******') self.assertIsNone(user) def test_unknown_user(self): user = self.backend.authenticate(email='*****@*****.**', password='******') self.assertIsNone(user) def test_get_user(self): self.assertIsNotNone(self.backend.get_user(1))
class EmailBackendTest(TestCase): def setUp(self): UserModel = get_user_model() UserModel.objects.create_user( username = '******', email = '*****@*****.**', password = '******' ) self.backend = EmailBackend() def test_authenticate_with_email(self): user = self.backend.authenticate( email = '*****@*****.**', password = '******' ) self.assertIsNotNone(user) def test_wrong_password(self): user = self.backend.authenticate( email = '*****@*****.**', password = '******' ) self.assertIsNone(user) def test_unknown_user(self): user = self.backend.authenticate( email = '*****@*****.**', password = '******' ) self.assertIsNone(user) def test_get_user(self): self.assertIsNotNone(self.backend.get_user(1))
def setUp(self): UserModel = get_user_model() UserModel.objects.create_user( username='******', email='*****@*****.**', password='******' ) self.backend = EmailBackend()
def setUp(self): UserModel = get_user_model() UserModel.objects.create_user( username = '******', email = '*****@*****.**', password = '******' ) self.backend = EmailBackend()
class MultipleEmailsTest(TestCase): def setUp(self): UserModel = get_user_model() UserModel.objects.create_user(username='******', email='*****@*****.**', password='******') UserModel.objects.create_user(username='******', email='*****@*****.**', password='******') self.backend = EmailBackend() def test_multiple_emails(self): user = self.backend.authenticate(email='*****@*****.**',password='******') self.assertIsNone(user)
class MultipleEmailsTest(TestCase): def setUp(self): UserModel = get_user_model() UserModel.objects.create_user( username = '******', email = '*****@*****.**', password = '******' ) UserModel.objects.create_user( username = '******', email = '*****@*****.**', password = '******' ) self.backend = EmailBackend() def test_multiple_emails(self): user = self.backend.authenticate( email = '*****@*****.**', password = '******' ) self.assertIsNone(user)