def not_supported(self):
pecan.abort(405)
- @expose()
+ @utils.expose()
def _lookup(self, collection, *remainder):
+ # if collection exists in the extension to service plugins map then
+ # we are assuming that collection is the service plugin and
+ # needs to be remapped.
+ # Example: https://neutron.endpoint/v2.0/lbaas/loadbalancers
+ if (remainder and
+ manager.NeutronManager.get_service_plugin_by_path_prefix(
+ collection)):
+ collection = remainder[0]
+ remainder = remainder[1:]
controller = manager.NeutronManager.get_controller_for_resource(
collection)
if not controller:
import os
+ from collections import namedtuple
import mock
from oslo_config import cfg
+from oslo_policy import policy as oslo_policy
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
+ import pecan
from pecan import request
from pecan import set_config
from pecan.testing import load_test_app
from neutron import context
from neutron import manager
from neutron.pecan_wsgi.controllers import root as controllers
+from neutron import policy
from neutron.tests.unit import testlib_api
+ _SERVICE_PLUGIN_RESOURCE = 'serviceplugin'
+ _SERVICE_PLUGIN_COLLECTION = _SERVICE_PLUGIN_RESOURCE + 's'
+ _SERVICE_PLUGIN_INDEX_BODY = {_SERVICE_PLUGIN_COLLECTION: []}
+
+
+ class FakeServicePluginController(object):
+ resource = _SERVICE_PLUGIN_RESOURCE
+
+ @pecan.expose(generic=True,
+ content_type='application/json',
+ template='json')
+ def index(self):
+ return _SERVICE_PLUGIN_INDEX_BODY
+
class PecanFunctionalTest(testlib_api.SqlTestCase):