Beispiel #1
0
def test_login_account_does_not_exist_fails():
    # 4.3.1 Account does not exist
    manager = AccountManager()

    with pytest.raises(AccountDoesNotExistException):
        assert manager.login(
            '*****@*****.**', 'wowza'), 'Expected login to fail due to a non-existing account'
Beispiel #2
0
def test_login_account_with_correct_information_success():
    # 4.3.5 Login success
    manager = AccountManager()
    account = Account('*****@*****.**')
    account.password = '******'
    account.is_locked = False

    manager.add_account(account)

    assert manager.login(account.email_address,
                         account.password) == True, 'Expected login to succeed'
Beispiel #3
0
def test_login_account_is_banned_fails():
    # 4.3.4 Account is banned
    manager = AccountManager()
    account = Account('*****@*****.**')
    account.password = '******'
    account.is_locked = False
    account.is_banned = True

    manager.add_account(account)

    with pytest.raises(AccountBannedException):
        assert manager.login(
            account.email_address, account.password), 'Expected login to fail due to banned account'
Beispiel #4
0
def test_login_password_is_incorrect_fails():
    # 4.3.2 Password is incorrect
    manager = AccountManager()
    account = Account('*****@*****.**')
    account.password = '******'
    account.is_locked = False
    account.is_banned = False

    manager.add_account(account)

    with pytest.raises(AccountIncorrectPasswordException):
        assert manager.login(
            account.email_address, 'wrongPassword2'), 'Expected login to fail due to incorrect password'