def logged_out_user_with_email_and_password(context, state, email, password):
    context.user = UserFactory(
        email=email,
        password=password,
        state=state,
    )
    DjangoClient().logout()
def user_with_state_email_and_password(context, state, email_address,
                                       password):
    assert state in ['active', 'pending']
    return UserFactory(
        email=email_address,
        password=password,
        state=state,
    )
def logged_active_user_with_newsletter_subscription_enabled(
        context, email, activation_code):
    user = UserFactory(email=email, password='******', state='active')
    subscription = Subscription.subscribe(email, user=user)
    subscription.activation_code = activation_code
    subscription.confirm_subscription()
    context.user = user
    DjangoClient().force_login(context.user)
def logged_active_user(context):
    context.user = UserFactory(email='*****@*****.**',
                               password='******',
                               state='active')
    DjangoClient().force_login(context.user)
def logged_as_another_removed_user_with_email_and_password(
        context, email_address, password):
    context.user = UserFactory(email=email_address,
                               password=password,
                               is_removed=True)
    DjangoClient().force_login(context.user)
def user_for_data(context, state, data_str):
    assert state in ['active', 'pending']
    data = json.loads(data_str)
    data['state'] = state
    return UserFactory(**data)
def logged_as_another_removed_user(context):
    context.user = UserFactory(email='*****@*****.**',
                               password='******',
                               is_removed=True)
    DjangoClient().force_login(context.user)
def logged_as_another_blocked_user_with_email_and_password(
        context, email_address, password):
    context.user = UserFactory(email=email_address,
                               password=password,
                               state='blocked')
    DjangoClient().force_login(context.user)
def logged_as_another_blocked_user(context):
    context.user = UserFactory(email='*****@*****.**',
                               password='******',
                               state='blocked')
    DjangoClient().force_login(context.user)
def logged_pending_user_with_email_and_password(context, email_address,
                                                password):
    context.user = UserFactory(email=email_address,
                               password=password,
                               state='pending')
    DjangoClient().force_login(context.user)
Example #11
0
def active_user():
    return UserFactory.create(email='*****@*****.**',
                              password='******',
                              state='active')
Example #12
0
def removed_user():
    return UserFactory.create(email='*****@*****.**',
                              password='******',
                              is_removed=True)
Example #13
0
def blocked_user():
    return UserFactory.create(email='*****@*****.**',
                              password='******',
                              state='blocked')