本文整理汇总了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))
示例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))
示例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))
示例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))
示例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))
示例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))
示例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)
示例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))
示例9: setUp
def setUp(self):
UserModel = get_user_model()
UserModel.objects.create_user(
username='dyego',
email='[email protected]',
password='abracadabra')
self.backend = EmailBackend()
示例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()
示例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()
示例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()
示例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)
示例14: setUp
def setUp(self):
UserModel = get_user_model()
UserModel.objects.create_user(
username='antonio',
email='[email protected]',
password='abracadabra')
self.backend = EmailBackend()
示例15: setUp
def setUp(self):
UserModel = get_user_model()
UserModel.objects.create_user(
username='regis',
email='[email protected]',
password='1234')
self.backend = EmailBackend()