Example #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_unknow_user(self):
        user = self.backend.authenticate(email='*****@*****.**',
                                         password='******')
        self.assertIsNone(user)

    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
Example #2
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_unknow_user(self):
        user = self.backend.authenticate(
            email='*****@*****.**',
            password='******'
        )
        self.assertIsNone(user)
Example #3
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))
Example #4
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))
Example #5
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))
Example #6
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_unkown_user(self):
        user = self.backend.authenticate(email='*****@*****.**',
                                         password='******')

        self.assertIsNone(user)

    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
Example #7
0
class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(
            username='******',
            email='*****@*****.**',
            password='******',
        )
        self.backend = EmailBackend()

    def test_autenticate_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))
Example #8
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))
Example #9
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))
Example #10
0
class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(
                username='******',
                email   ='*****@*****.**',
                password= '******',)                
        self.backend = EmailBackend()
        
    def test_autenticate_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))
Example #11
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))
Example #12
0
class EmailBackendTest(TestCase):
    """
    Test class.
    """
    def setUp(self):
        """
        Test initialization.
        """
        UserModel = get_user_model()
        UserModel.objects.create_user(
            username='******',
            email='*****@*****.**',
            password='******'
        )
        self.backend = EmailBackend()

    def test_authenticate_with_email(self):
        """
        Backend should be able to handle email as user id.
        """
        user = self.backend.authenticate(
            email='*****@*****.**',
            password='******'
        )
        self.assertIsNotNone(user)

    def test_wrong_password(self):
        """
        Backend should not authenticate user with bad password.
        """
        user = self.backend.authenticate(
            email='*****@*****.**',
            password='******'
        )
        self.assertIsNone(user)

    def test_unknown_user(self):
        """
        Backend should not authenticate unknown user.
        """
        user = self.backend.authenticate(
            email='*****@*****.**',
            password='******'
        )
        self.assertIsNone(user)

    def test_get_user(self):
        """
        Backend should have 'get_user' method.
        """
        self.assertIsNotNone(self.backend.get_user(1))
Example #13
0
class MultipleEmailsTest(TestCase):
    """
    Test class.
    """
    def setUp(self):
        """
        Test initialization.
        """
        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):
        """
        Backend should not authenticate users with same emails.
        """
        user = self.backend.authenticate(
            email='*****@*****.**',
            password='******'
        )
        self.assertIsNone(user)
Example #14
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)
Example #15
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)
Example #16
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)
Example #17
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_email(self):
        user = self.backend.authenticate(email='*****@*****.**',
                                         password='******')
        self.assertIsNone(user)
Example #18
0
class MultipleEmailTest(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)
Example #19
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)
Example #20
0
class MultipleEmailTeste(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)
Example #21
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)
Example #22
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)