Esempio n. 1
0
 def test_get_user(self):
     settings.CUSTOM_USER_MODEL = None
     user = User.objects.create_user("jsmith", "*****@*****.**", "test123")
     backend = EmailBackend()
     u = backend.get_user(1)
     self.assertEqual(u, user)
     u = backend.get_user(2)
     self.assertEqual(u, None)
Esempio n. 2
0
 def test_authenticate(self):
     settings.CUSTOM_USER_MODEL = None
     user = User.objects.create_user("jsmith", "*****@*****.**", "test123")
     backend = EmailBackend()
     u = backend.authenticate("*****@*****.**","badpassword")
     self.assertEqual(u, None)
     u = backend.authenticate("jsmith","test123")
     self.assertEqual(u, None)
     u = backend.authenticate("*****@*****.**","test123")
     self.assertEqual(u, user)