'If the getpwnam function raises a KeyError, the login fails with an
L{UnauthorizedLogin} exception.'

def test_failOnKeyError(self):

    def getpwnam(username):
        raise KeyError(username)
    checker = checkers.UNIXPasswordDatabase([getpwnam])
    credential = UsernamePassword('username', 'username')
    self.assertUnauthorizedLogin(checker.requestAvatarId(credential))
