Exemplo n.º 1
0
def test_phonenumber_validity():
    invalid_phone_numbers = ["asdsa", "121", "00000"]

    for phonenumber in invalid_phone_numbers:
        reg = Registration()
        assert reg.verify_phone_number(
            phonenumber) == True, "Invalid phone number supplied"
Exemplo n.º 2
0
def test_oauth_token_received():
    invalid_http_responses = ["invalid_user", "access_denied"]

    for response in invalid_http_responses:
        reg = Registration()
        assert reg.verify_oauth_token_received(
            response) == True, "Invalid HTTP response received"
Exemplo n.º 3
0
def test_oauth_auth_code_flow():
    invalid_http_responses = ["error", "invalid_credentials"]

    for response in invalid_http_responses:
        reg = Registration()
        assert reg.verify_oauth_authorization_code_flow(
            response) == True, "Invalid HTTP response received"
Exemplo n.º 4
0
def test_account_locked_error_message():
    invalid_errors = [
        "Your account is locked", "Thou art banished from thine account"
    ]
    for message in invalid_errors:
        reg = Registration()
        assert reg.display_locked_account_error_message(
            message) == True, "Account lockout error message not correct!"
Exemplo n.º 5
0
def test_redirect_after_login():
    invalid_redirect_uri = ["google.com", "donaldjtrump.com"]

    for response in invalid_redirect_uri:
        reg = Registration()
        assert reg.verify_oauth_authorization_code_flow(
            response
        ) == "https://www.dinnerisserverdanddelivered.com", "Invalid redirect detected"
Exemplo n.º 6
0
def test_valid_email_and_phone_for_password_reset_request():
    invalid_phone_numbers = ["lalalala", "hahahaha", "blablablablabla"]
    invalid_emails = ["*****@*****.**", "*****@*****.**", "*****@*****.**"]
    for x in range(len(invalid_emails)):
        reg = Registration()
        assert reg.check_email_and_phonenumber(
            invalid_emails[x], invalid_phone_numbers[x]
        ) == True, "Invalid information supplied for password reset request!"
Exemplo n.º 7
0
def test_password_complexity():
    invalid_passwords = [
        "invalid", "password", "bad", "evil", "good", "lukewarm"
    ]

    for password in invalid_passwords:
        reg = Registration()
        assert reg.verify_password_complexity(
            password) == True, "Invalid password supplied"
Exemplo n.º 8
0
def test_relogin_attempts():
    count = 6
    reg = Registration()
    assert reg.lock_account_after_5_login_attempts(
        count) == True, "Account not locked out after more than 5 attempts"
Exemplo n.º 9
0
def test_successful_login():
    reg = Registration()
    user = None
    assert reg.successful_login(user) == True, "login not successful"
Exemplo n.º 10
0
def test_login_credentials():
    invalid_credentials = {"invalid_username", "invalid_password"}
    reg = Registration()
    assert reg.check_credentials(
        invalid_credentials
    ) == True, "Invalid credentials, login not successful!"
Exemplo n.º 11
0
def test_email_validity():
    invalid_emails = ["not", "a", "valid", "email"]

    for email in invalid_emails:
        reg = Registration()
        assert reg.verify_email(email) == True, "Invalid password supplied"
Exemplo n.º 12
0
def test_reset_password_link():
    user = None
    reg = Registration()
    assert reg.generate_password_reset_link(
        user) == True, "Password reset link not generated!"
Exemplo n.º 13
0
def test_forgotten_password_button():
    button = None  #UI element needed here, which isn't possible
    reg = Registration()
    assert reg.check_forgotten_password_button(
        button) == True, "Forgotten password button not available!"