Exemple #1
0
def test_auth_password_request_invalid():
    """
    Test attempting to request for a password with an unregistered email
    """
    clear()
    with pytest.raises(InputError):
        auth.auth_password_request("*****@*****.**")
Exemple #2
0
def test_auth_password_no_reset_code_found():
    """
    
    """
    clear()
    auth.auth_register("*****@*****.**", "SecurePass8192", "Heck",
                       "Incorporated")
    auth.auth_password_request("*****@*****.**")
    with pytest.raises(InputError):
        auth.auth_password_reset("RANDOM_CODE", "password")
Exemple #3
0
def req():
    '''Given a users email send them an email with a rest code'''
    payload = request.get_json()
    email = payload['email']
    if email is None:
        raise InputError(description='Invalid Email')
    res = auth_password_request(email)
    return dumps(res)
Exemple #4
0
def auth_passwordreset_request_http():
    """This is the POST method sending an email to the user who requested their
    password to be changed."""
    if request.is_json:
        req_data = request.get_json()
        email = req_data["email"]
        response = auth_password_request(email)
        return json.dumps(response), 200
    return "JSON not received", 400
Exemple #5
0
def test_auth_password_request_valid():
    """
    Passing in valid inputs to password request for a registered user
    Result will send an email to that email with an authenticated code for resetting password
    But returns an empty dict as per spec
    """
    clear()
    auth.auth_register("*****@*****.**", "SecurePass8192", "Heck",
                       "Incorporated")
    result = auth.auth_password_request("*****@*****.**")
    assert result == {}