def use_account_with_valid_access_token(context): """Setup test context with an authenticated account for future steps.""" context.username = "******" context.access_token = generate_access_token(context) set_access_token_cookie(context) context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context)
def expire_both_tokens(context): context.username = "******" context.access_token = generate_access_token(context, duration=EXPIRE_IMMEDIATELY) set_access_token_cookie(context, duration=EXPIRE_IMMEDIATELY) context.refresh_token = generate_refresh_token(context, duration=EXPIRE_IMMEDIATELY) set_refresh_token_cookie(context, duration=EXPIRE_IMMEDIATELY)
def generate_expired_access_token(context): context.username = "******" context.access_token = generate_access_token(context, duration=EXPIRE_IMMEDIATELY) set_access_token_cookie(context, duration=EXPIRE_IMMEDIATELY) context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context) context.old_refresh_token = context.refresh_token.jwt
def add_membership_to_account(context): """Use the API to add a monthly membership on Stripe The API is used so that the Stripe API can be interacted with. """ context.username = '******' context.access_token = generate_access_token(context) set_access_token_cookie(context) context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context) add_membership_via_api(context)
def add_membership_to_account(context): """Use the API to add a monthly membership on Stripe The API is used so that the Stripe API can be interacted with. """ context.username = "******" context.access_token = generate_access_token(context) set_access_token_cookie(context) context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context) _add_membership_via_api(context) acct_repository = AccountRepository(context.db) membership = acct_repository.get_active_account_membership( context.accounts["foo"].id) context.accounts["foo"].membership = membership
def use_account_with_valid_access_token(context): context.access_token = generate_access_token(context) set_access_token_cookie(context) context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context)
def generate_refresh_token_only(context): context.username = "******" context.refresh_token = generate_refresh_token(context) set_refresh_token_cookie(context) context.old_refresh_token = context.refresh_token.jwt
def call_logout_endpoint(context): """Call the single sign on endpoint to logout a user.""" generate_access_token(context) generate_refresh_token(context) context.response = context.client.get("/api/logout")