Update StateBackend.authenticate to match ModelBackend

Also, change setup to no longer include Django 1.11
This commit is contained in:
colcrunch 2019-03-12 10:05:05 +00:00 committed by Basraah
parent e9ed917888
commit 287da73a4f
4 changed files with 3 additions and 11 deletions

View File

@ -25,14 +25,6 @@
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
py36-dj111:
<<: *job_definition
image: python:3.6-stretch
script:
- export TOXENV=py36-dj111
- tox
py36-dj20:
<<: *job_definition
image: python:3.6-stretch

View File

@ -27,7 +27,7 @@ class StateBackend(ModelBackend):
user_obj._perm_cache.update(self.get_state_permissions(user_obj))
return user_obj._perm_cache
def authenticate(self, token=None):
def authenticate(self, request=None, token=None, **credentials):
if not token:
return None
try:

View File

@ -119,7 +119,7 @@ class BackendTestCase(TestCase):
def test_authenticate_character_record(self):
t = Token(character_id=self.unclaimed_character.character_id, character_name=self.unclaimed_character.character_name, character_owner_hash='4')
record = OwnershipRecord.objects.create(user=self.old_user, character=self.unclaimed_character, owner_hash='4')
user = StateBackend().authenticate(t)
user = StateBackend().authenticate(token=t)
self.assertEqual(user, self.old_user)
self.assertTrue(CharacterOwnership.objects.filter(owner_hash='4', user=self.old_user).exists())
self.assertTrue(user.profile.main_character)

View File

@ -16,7 +16,7 @@ install_requires = [
'celery>=4.0.2',
'celery_once',
'django>=1.11,<=2.0.8',
'django>=2.0',
'django-bootstrap-form',
'django-registration==2.4',
'django-sortedm2m',