Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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
Пример #4
0
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)
Пример #5
0
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
Пример #6
0
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)