コード例 #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)
コード例 #7
0
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
コード例 #8
0
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")