Exemple #1
0
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))
Exemple #2
0
 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(
         username='******',
         email='*****@*****.**',
         password='******'
     )
     self.backend = EmailBackend()
Exemple #3
0
 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(username='******',
                                   email='*****@*****.**',
                                   password='******')
     UserModel.objects.create_user(username='******',
                                   email='*****@*****.**',
                                   password='******')
     self.backend = EmailBackend()
Exemple #4
0
 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(
         username='******',
         email='*****@*****.**',
         password='******'
     )
     UserModel.objects.create_user(
         username='******',
         email='*****@*****.**',
         password='******'
     )
     self.backend = EmailBackend()
Exemple #5
0
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)
Exemple #6
0
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)