Example #1
0
def test_reauthenticate_fail():
    login = "******"
    authr = DummyAuthenticator(ACCOUNTS)
    db = UserDB(authr)
    account, real_pw = ACCOUNTS[login]
    assert db.authenticate(login, real_pw) == account
    # Re-authentication should not hit the authenticator.
    authr.accounts = {}
    assert db.authenticate(login, "wrong_pw") is None
Example #2
0
def test_authenticate_fail():
    authr = DummyAuthenticator({})
    db = UserDB(authr)
    assert db.authenticate("marc", "test4321") is None
Example #3
0
def test_authenticate_ok():
    login = "******"
    authr = DummyAuthenticator(ACCOUNTS)
    db = UserDB(authr)
    account, real_pw = ACCOUNTS[login]
    assert db.authenticate(login, real_pw) == account