mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 20:40:17 +02:00
Update StateBackend.authenticate to match ModelBackend
Also, change setup to no longer include Django 1.11
This commit is contained in:
parent
e9ed917888
commit
287da73a4f
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user