当前位置: 首页>>代码示例>>Python>>正文


Python backends.EmailBackend类代码示例

本文整理汇总了Python中eventex.myauth.backends.EmailBackend的典型用法代码示例。如果您正苦于以下问题:Python EmailBackend类的具体用法?Python EmailBackend怎么用?Python EmailBackend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EmailBackend类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: EmailBackendTest

class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(username='henrique',
                                      email='[email protected]',
                                      password='abracadabra')
        self.backend = EmailBackend()

    def test_authenticate_with_email(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='abracadabra')
        self.assertIsNotNone(user)

    def test_wrong_password(self):
        user = self.backend.authenticate(email='[email protected]',
                                          password='wrong')
        self.assertIsNone(user)

    def test_unknown_user(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='abracadabra')
        self.assertIsNone(user)

    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
开发者ID:erichideki,项目名称:wttd,代码行数:25,代码来源:test_backends.py

示例2: EmailBackendTest

class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(
                username='diekson',
                email   ='[email protected]',
                password= 'senha',)                
        self.backend = EmailBackend()
        
    def test_autenticate_with_email(self):
        user = self.backend.authenticate(
                email   ='[email protected]',
                password='senha',)        
        self.assertIsNotNone(user)
        
    def test_wrong_password(self):
        user = self.backend.authenticate(
                email   ='[email protected]',
                password= 'elado',)        
        self.assertIsNone(user)
        
    def test_unknown_user(self):
        user = self.backend.authenticate(
                email   ='[email protected]',
                password='senha',)
        self.assertIsNone(user)
        
    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
开发者ID:diekson,项目名称:eventex,代码行数:29,代码来源:test_backends.py

示例3: EmailBackendTest

class EmailBackendTest(TestCase):
	def setUp(self):
		UserModel = get_user_model()
		UserModel.objects.create_user(
			username='regis',
			email='[email protected]',
			password='1234')
		self.backend = EmailBackend()

	def test_authenticate_with_email(self):
		user = self.backend.authenticate(
			email='[email protected]',
			password='1234')
		self.assertIsNotNone(user)

	def test_wrong_password(self):
		user = self.backend.authenticate(
			email='[email protected]',
			password='wrong')
		self.assertIsNone(user)

	def test_unknown_user(self):
		user = self.backend.authenticate(
			email='[email protected]',
			password='1324')
		self.assertIsNone(user)

	def test_get_user(self):
		self.assertIsNotNone(self.backend.get_user(1))
开发者ID:davinirjr,项目名称:wttd,代码行数:29,代码来源:test_backends.py

示例4: EmailBackendTest

class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(username='marcos',
                                      email='[email protected]',
                                      password='123456')
        self.backend = EmailBackend()

    def test_authenticate_with_email(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='123456')
        self.assertIsNotNone(user)

    def test_wrong_password(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='errada')
        self.assertIsNone(user)

    def test_unknow_user(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='123456')
        self.assertIsNone(user)

    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
开发者ID:marcosmribeiro,项目名称:wttd,代码行数:25,代码来源:test_backends.py

示例5: EmailBackendTest

class EmailBackendTest(TestCase):
	def setUp(self):
		UserModel = get_user_model()
		UserModel.objects.create_user(username='fernando',
			                          email='[email protected]',
			                          password='goiabada')
		self.backend = EmailBackend()

	def test_authenticate_with_email(self):
		user = self.backend.authenticate(email='[email protected]',
			                             password='goiabada')
		self.assertIsNotNone(user)

	def test_wrong_password(self):
		user = self.backend.authenticate(email='[email protected]',
			                             password='goiaba')
		self.assertIsNone(user)

	def test_unknown_user(self):
		user = self.backend.authenticate(email='[email protected]',
			                             password='goiabada')
		self.assertIsNone(user)

	def test_get_user(self):
		self.assertIsNotNone(self.backend.get_user(1))
开发者ID:fernandochimi,项目名称:wttd,代码行数:25,代码来源:test_backends.py

示例6: EmailBackendTest

class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(username='felipe',
                                      email='[email protected]',
                                      password='admin')
        self.backend = EmailBackend()
        
    def test_authenticate_with_email(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='admin')
        self.assertIsNotNone(user)
    
    def test_wrong_password(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='wrong')
        self.assertIsNone(user)
    
    def test_unknown_user(self):
        user = self.backend.authenticate(email='[email protected]',
                                         password='admin')
        self.assertIsNone(user)
        
    def test_get_user(self):
        self.assertIsNotNone(self.backend.get_user(1))
开发者ID:fscampini,项目名称:scampiniwttd,代码行数:25,代码来源:test_backends.py

示例7: EmailBackendTest

class EmailBackendTest(TestCase):
    def setUp(self):
        UserModel = get_user_model()
        UserModel.objects.create_user(
            username='giovani',
            email='[email protected]',
            password='123456'
        )
        self.backend = EmailBackend()

    def test_authenticate_with_email(self):
        user = self.backend.authenticate(
            email='[email protected]',
            password='123456'
        )
        self.assertIsNotNone(user)

    def test_wrong_password(self):
        user = self.backend.authenticate(
            email='[email protected]',
            password='654321'
        )
        self.assertIsNone(user)

    def test_unknow_user(self):
        user = self.backend.authenticate(
            email='[email protected]',
            password='741852'
        )
        self.assertIsNone(user)
开发者ID:fontanagiovani,项目名称:eventex,代码行数:30,代码来源:test_backends.py

示例8: EmailBackendTest

class EmailBackendTest(TestCase):
    """
    Test class.
    """
    def setUp(self):
        """
        Test initialization.
        """
        UserModel = get_user_model()
        UserModel.objects.create_user(
            username='davi',
            email='[email protected]',
            password='abracadabra'
        )
        self.backend = EmailBackend()

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

    def test_wrong_password(self):
        """
        Backend should not authenticate user with bad password.
        """
        user = self.backend.authenticate(
            email='[email protected]',
            password='wrong'
        )
        self.assertIsNone(user)

    def test_unknown_user(self):
        """
        Backend should not authenticate unknown user.
        """
        user = self.backend.authenticate(
            email='[email protected]',
            password='wrong'
        )
        self.assertIsNone(user)

    def test_get_user(self):
        """
        Backend should have 'get_user' method.
        """
        self.assertIsNotNone(self.backend.get_user(1))
开发者ID:davivcgarcia,项目名称:wttd-15,代码行数:51,代码来源:test_backends.py

示例9: setUp

 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(
             username='dyego',
             email='[email protected]',
             password='abracadabra')
     self.backend = EmailBackend()
开发者ID:dyegocantu,项目名称:eventex-old,代码行数:7,代码来源:test_backends.py

示例10: setUp

 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(username='user1',
         email='[email protected]', password='abracadabra')
     UserModel.objects.create_user(username='user2',
         email='[email protected]', password='abracadabra')
     self.backend = EmailBackend() 
开发者ID:marcio28,项目名称:wttd,代码行数:7,代码来源:test_backends.py

示例11: setUp

	def setUp(self):
		UserModel = get_user_model()
		UserModel.objects.create_user(username='user1',
			email='[email protected]', password='goiabada')
		UserModel.objects.create_user(username='user2',
			email='[email protected]', password='goiabada')
		self.backend = EmailBackend()
开发者ID:fernandochimi,项目名称:wttd,代码行数:7,代码来源:test_backends.py

示例12: setUp

 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(username='user1',
         email='[email protected]', password='abcdef')
     UserModel.objects.create_user(username='user2',
         email='[email protected]', password='abcdef')
     self.backend = EmailBackend()
开发者ID:joplen,项目名称:Eventex,代码行数:7,代码来源:test_backends.py

示例13: MultipleEmailsTest

class MultipleEmailsTest(TestCase):
    """
    Test class.
    """
    def setUp(self):
        """
        Test initialization.
        """
        UserModel = get_user_model()
        UserModel.objects.create_user(
            username='user1',
            email='[email protected]',
            password='abracadabra',
        )
        UserModel.objects.create_user(
            username='user2',
            email='[email protected]',
            password='abracadabra',
        )
        self.backend = EmailBackend()

    def test_multiple_emails(self):
        """
        Backend should not authenticate users with same emails.
        """
        user = self.backend.authenticate(
            email='[email protected]',
            password='abracadabra'
        )
        self.assertIsNone(user)
开发者ID:davivcgarcia,项目名称:wttd-15,代码行数:30,代码来源:test_backends.py

示例14: setUp

 def setUp(self):
     UserModel = get_user_model()
     UserModel.objects.create_user(
                                 username='antonio',
                                 email='[email protected]',
                                 password='abracadabra')
     self.backend = EmailBackend()
开发者ID:miquelini,项目名称:eventex,代码行数:7,代码来源:test_backends.py

示例15: setUp

	def setUp(self):
		UserModel = get_user_model()
		UserModel.objects.create_user(
			username='regis',
			email='[email protected]',
			password='1234')
		self.backend = EmailBackend()
开发者ID:davinirjr,项目名称:wttd,代码行数:7,代码来源:test_backends.py


注:本文中的eventex.myauth.backends.EmailBackend类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。