added a username parameter to the token generation so that more than one account can be used in testing

pull/183/head
Chris Veilleux 2019-06-12 10:33:53 -05:00
parent 24dbd72f4d
commit b0f7f8cbf7
1 changed files with 6 additions and 2 deletions

View File

@ -10,13 +10,17 @@ TWO_MINUTES = 120
REFRESH_TOKEN_COOKIE_KEY = 'seleneRefresh'
def generate_access_token(context, expire=False):
def generate_access_token(context, username='foo', expire=False):
access_token = AuthenticationToken(
context.client_config['ACCESS_SECRET'],
ONE_MINUTE
)
if not expire:
access_token.generate(context.account.id)
if username == 'bar':
account_id = context.bar_account.id
else:
account_id = context.foo_account.id
access_token.generate(account_id)
context.access_token = access_token
context.client.set_cookie(