Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

test_auth_backend.py 960B

1234567891011121314151617181920212223242526
  1. import unittest
  2. import django
  3. from django.test import TestCase
  4. from oscar.apps.customer.auth_backends import EmailBackend
  5. from oscar.test.factories import UserFactory
  6. class AuthBackendTestCase(TestCase):
  7. def setUp(self):
  8. self.user = UserFactory(email='foo@example.com', is_staff=True)
  9. self.user.set_password('letmein')
  10. self.user.save()
  11. self.backend = EmailBackend()
  12. @unittest.skipUnless(django.VERSION < (1, 11), "for Django <1.11 only")
  13. def test_authentication_method_signature_pre_django_1_11(self):
  14. auth_result = self.backend.authenticate('foo@example.com', 'letmein')
  15. self.assertEqual(auth_result, self.user)
  16. @unittest.skipUnless(django.VERSION >= (1, 11), "for Django >=1.11 only")
  17. def test_authentication_method_signature_post_django_1_11(self):
  18. auth_result = self.backend.authenticate(None, 'foo@example.com', 'letmein')
  19. self.assertEqual(auth_result, self.user)