Beispiel #1
0
def _assert_valid_reset_password_verification_email(sent_email, user):
    assert sent_email.from_email == VERIFICATION_FROM_EMAIL
    assert sent_email.to == [user.email]
    url = assert_one_url_line_in_text(sent_email.body)
    verification_data = assert_valid_verification_url(
        url,
        expected_path=RESET_PASSWORD_VERIFICATION_URL,
        expected_fields={'signature', 'user_id', 'timestamp'},
    )
    return verification_data
Beispiel #2
0
def assert_valid_send_link_email(sent_email, user, timer):
    assert sent_email.from_email == VERIFICATION_FROM_EMAIL
    assert sent_email.to == [user.email]
    url = assert_one_url_line_in_text(sent_email.body)
    verification_data = assert_valid_verification_url(
        url,
        expected_path=RESET_PASSWORD_VERIFICATION_URL,
        expected_fields={'signature', 'user_id', 'timestamp'},
        signer_cls=ResetPasswordSigner,
        timer=timer,
    )
    assert int(verification_data['user_id']) == user.id
    return verification_data
def assert_valid_register_email_verification_email(sent_email, user, new_email,
                                                   timer):
    assert sent_email.from_email == VERIFICATION_FROM_EMAIL
    assert sent_email.to == [new_email]
    url = assert_one_url_line_in_text(sent_email.body)

    verification_data = assert_valid_verification_url(
        url,
        expected_path=REGISTER_EMAIL_VERIFICATION_URL,
        expected_fields={'signature', 'user_id', 'timestamp', 'email'},
        timer=timer,
        signer_cls=RegisterEmailSigner,
    )
    url_user_id = int(verification_data['user_id'])
    assert url_user_id == user.pk
Beispiel #4
0
def assert_valid_register_verification_email(sent_email, user, timer):
    assert sent_email.from_email == VERIFICATION_FROM_EMAIL
    assert sent_email.to == [user.email]
    url = assert_one_url_line_in_text(sent_email.body)

    verification_data = assert_valid_verification_url(
        url,
        expected_path=REGISTER_VERIFICATION_URL,
        expected_fields={'signature', 'user_id', 'timestamp'},
    )
    url_user_id = int(verification_data['user_id'])
    assert url_user_id == user.pk
    url_sig_timestamp = int(verification_data['timestamp'])
    assert timer.start_time <= url_sig_timestamp <= timer.end_time
    signer = RegisterSigner(verification_data)
    signer.verify()