コード例 #1
0
def test_auth_passwordreset_reset_invalid_reset_code():
    clear_v2()
    auth_register_v2("*****@*****.**", "iteration3", "cameron", "burrell")
    email = "*****@*****.**"
    auth_passwordreset_request_v1(email)
    with pytest.raises(InputError):
        auth_passwordreset_reset_v1("@#$$**!!", "hdwdssdw111")
コード例 #2
0
def test_auth_passwordreset_reset_invalid_password_less_than_6_characters():
    clear_v2()
    auth_register_v2("*****@*****.**", "iteration3", "cameron", "burrell")
    email = "*****@*****.**"
    auth_passwordreset_request_v1(email)
    test_reset_code = "test"
    with pytest.raises(InputError):
        auth_passwordreset_reset_v1(test_reset_code, "hdwd")
コード例 #3
0
def test_invalid_reset_code():
    '''
    reset_code is not a valid reset code
    '''
    clear_v1()
    auth_register_v2('*****@*****.**', 'asdjf~!', 'Rengoku', 'Kyojuro')
    auth_passwordreset_request_v1('*****@*****.**')
    with pytest.raises(InputError):
        auth_passwordreset_reset_v1('11111111', 'babus1337')
コード例 #4
0
def test_invalid_password():
    '''
    password entered is less than 6 characters long
    '''
    clear_v1()
    auth_register_v2('*****@*****.**', 'asdjf~!', 'Rengoku', 'Kyojuro')
    auth_passwordreset_request_v1('*****@*****.**')
    with open("email.json") as e_file:
        email = load(e_file)
    with pytest.raises(InputError):
        auth_passwordreset_reset_v1(email['reset_code'], 'babus')
コード例 #5
0
def test_passwordreset_request():
    '''
    Test for auth_passwordreset_request
    '''
    clear_v1()
    auth_register_v2('*****@*****.**', 'asdjf~!', 'Rengoku', 'Kyojuro')
    auth_passwordreset_request_v1('*****@*****.**')
    with open("email.json") as e_file:
        email = load(e_file)
    assert email['email'] == '*****@*****.**'
    assert email[
        'reset_code'] == 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6IjA5MTRyZW5nb2t1QGdtYWlsLmNvbSJ9.4PSUL-j77jD1v3IYo-0Ctji8h3jIY4n5qaXM5G75QOo'
コード例 #6
0
def test_successful_reset():
    '''
    password has succesfully changed given reset_code and new_password
    '''
    clear_v1()
    user = auth_register_v2('*****@*****.**', 'asdjf~!', 'Rengoku',
                            'Kyojuro')
    auth_logout_v2(user['token'])
    auth_passwordreset_request_v1('*****@*****.**')
    with open("email.json") as e_file:
        email = load(e_file)
    auth_passwordreset_reset_v1(email['reset_code'], 'babus1337')
    user_session_1 = auth_login_v2('*****@*****.**', 'babus1337')
    assert user_session_1['auth_user_id'] == user['auth_user_id']
コード例 #7
0
ファイル: server.py プロジェクト: Stress-Puppy/1531
def passwordreset_request():
# i need to get the email
    parameters = request.get_json()
    email = parameters['email']
    auth_passwordreset_request_v1(email)
    name, code = ("","")
    for details in reset_codes:
        if details['email'] == email:
            name, code = (details['name'], details['code'])
    msg = Message('Reset Password Request for Dreams', sender =   '*****@*****.**', recipients = [email])
    dev_email = "*****@*****.**"
    msg.body = f'''Hey {name}\nYou have requested a password change for Dreams, 
please use the code provided to reset your password\n\nCODE:  
{code}\n\nIf you did not request a change of password please contact the dreams development 
team at\n*** {dev_email} ***\n\nKind Regards\n\nDreams Dev Team\nwed11bcactus'''
    mail.send(msg)
    return dumps({})
コード例 #8
0
ファイル: server.py プロジェクト: Chris-Luong/comp1531
def reset_request():
    info = request.get_json()
    email = info["email"]

    verified_email = auth_passwordreset_request_v1(email)

    msg = Message('Password Reset',
                  sender='*****@*****.**',
                  recipients=[verified_email["email"]])
    msg.body = "Your reset code is: " + str(verified_email["reset_code"])
    mail.send(msg)
    return dumps(verified_email)
コード例 #9
0
def test_write_data(reg_user, crt_channel, email):
    clear_v2()
    token = reg_user(0)['token']
    u_id_1 = reg_user(1)['auth_user_id']

    dm_id = dm_create_v1(token, [u_id_1])['dm_id']

    message_senddm_v1(token, dm_id, "Test")

    crt_channel(token, True)

    auth_passwordreset_request_v1(email(0))

    data_pre_write = package_data()

    write_data()
    read_data()

    data_post_write = package_data()

    assert data_pre_write == data_post_write
コード例 #10
0
ファイル: auth_test.py プロジェクト: Chris-Luong/comp1531
def test_invalid_email_password_reset():
    with pytest.raises(InputError):
        auth_passwordreset_request_v1('invalidemail') # invalid email
    with pytest.raises(InputError):
        auth_passwordreset_request_v1('*****@*****.**') # non-existent email
コード例 #11
0
def test_auth_passwordreset_request_v1_valid():
    clear_v2()
    auth_register_v2("*****@*****.**", "iteration3", "cameron", "burrell")
    email = "*****@*****.**"
    assert auth_passwordreset_request_v1(email) == {}
コード例 #12
0
def test_no_users():
    clear_v2()
    email = "*****@*****.**"
    assert auth_passwordreset_request_v1(email) == {}