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
def test_authenticate_fail(): authr = DummyAuthenticator({}) db = UserDB(authr) assert db.authenticate("marc", "test4321") is None
def test_authenticate_ok(): login = "******" authr = DummyAuthenticator(ACCOUNTS) db = UserDB(authr) account, real_pw = ACCOUNTS[login] assert db.authenticate(login, real_pw) == account