'If the verifyCryptedPassword function doesn\'t verify the password, the
login fails with an L{UnauthorizedLogin} exception.'

def test_failOnBadPassword(self):

    def verifyCryptedPassword(crypted, pw):
        return False
    def getpwnam(username):
        return [username, username]
    self.patch(checkers, 'verifyCryptedPassword', verifyCryptedPassword)
    checker = checkers.UNIXPasswordDatabase([getpwnam])
    credential = UsernamePassword('username', 'username')
    self.assertUnauthorizedLogin(checker.requestAvatarId(credential))
