Fix user:admin scope handling and add test

This commit is contained in:
Joseph Schorr 2016-05-09 11:16:01 +02:00
parent eae771a465
commit a736407611
3 changed files with 42 additions and 6 deletions

View file

@ -282,9 +282,10 @@ def list_applications_for_org(org):
return query
def create_access_token_for_testing(user_obj, client_id, scope):
def create_access_token_for_testing(user_obj, client_id, scope, access_token='test'):
expires_at = datetime.utcnow() + timedelta(seconds=10000)
application = get_application_for_client_id(client_id)
OAuthAccessToken.create(application=application, authorized_user=user_obj, scope=scope,
token_type='token', access_token='test',
expires_at=expires_at, refresh_token='', data='')
created = OAuthAccessToken.create(application=application, authorized_user=user_obj, scope=scope,
token_type='token', access_token=access_token,
expires_at=expires_at, refresh_token='', data='')
return created