'Any unexpected failure from L{Portal.login} results in a 500 response
code and causes the failure to be logged.'

def test_unexpectedLoginError(self):

    class UnexpectedException(Exception, ):
        pass
    class BrokenChecker(object, ):
        credentialInterfaces = (IUsernamePassword,)
        def requestAvatarId(self, credentials):
            raise UnexpectedException()
    self.portal.registerChecker(BrokenChecker())
    self.credentialFactories.append(BasicCredentialFactory('example.com'))
    request = self.makeRequest([self.childName])
    child = self._authorizedBasicLogin(request)
    request.render(child)
    self.assertEqual(request.responseCode, 500)
    self.assertEqual(len(self.flushLoggedErrors(UnexpectedException)), 1)
