From b0f7f8cbf71ca6e5ecfa5a84e6c1d1e59dc28b7f Mon Sep 17 00:00:00 2001 From: Chris Veilleux Date: Wed, 12 Jun 2019 10:33:53 -0500 Subject: [PATCH] added a username parameter to the token generation so that more than one account can be used in testing --- shared/selene/api/testing/authentication.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shared/selene/api/testing/authentication.py b/shared/selene/api/testing/authentication.py index 0b70f5db..d6c6d945 100644 --- a/shared/selene/api/testing/authentication.py +++ b/shared/selene/api/testing/authentication.py @@ -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(