Example #1
0
 def test_fails_if_all_failed(self, mock_exit):
     mock_exit.side_effect = test.TestingException
     self.flags(enabled_apis=['foo', 'bar'])
     with mock.patch.object(api, 'service') as mock_service:
         mock_service.WSGIService.side_effect = exception.PasteAppNotFound(
             name='foo', path='/')
         self.assertRaises(test.TestingException, api.main)
         mock_exit.assert_called_once_with(1)
         launcher = mock_service.process_launcher.return_value
         self.assertFalse(launcher.wait.called)
Example #2
0
    def load_app(self, name):
        """Return the paste URLMap wrapped WSGI application.

        :param name: Name of the application to load.
        :returns: Paste URLMap object wrapping the requested application.
        :raises: `nova.exception.PasteAppNotFound`

        """
        try:
            return deploy.loadapp("config:%s" % self.config_path, name=name)
        except LookupError as err:
            LOG.error(err)
            raise exception.PasteAppNotFound(name=name, path=self.config_path)
    def load_app(self, name):
        """Return the paste URLMap wrapped WSGI application.

        :param name: Name of the application to load.
        :returns: Paste URLMap object wrapping the requested application.
        :raises: `nova.exception.PasteAppNotFound`

        """
        try:
            LOG.debug("Loading app %(name)s from %(path)s",
                      {'name': name, 'path': self.config_path})
            return deploy.loadapp("config:%s" % self.config_path, name=name)
        except LookupError:
            LOG.exception(_LE("Couldn't lookup app: %s"), name)
            raise exception.PasteAppNotFound(name=name, path=self.config_path)
Example #4
0
 def fake_service(api, **kw):
     while count:
         count.pop()
         raise exception.PasteAppNotFound(name=api, path='/')
     return fake_server