Merge "shim _setUpExtension in prep to changing args"

This commit is contained in:
Zuul 2018-05-02 14:19:47 +00:00 committed by Gerrit Code Review
commit 892dab2df4
3 changed files with 25 additions and 11 deletions

View File

@ -36,16 +36,31 @@ CORE_PLUGIN = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
class ExtensionTestCase(testlib_api.WebTestCase): class ExtensionTestCase(testlib_api.WebTestCase):
# TODO(boden): phase out resource_attribute_map # TODO(boden): remove once all consumers use _setup_extension
def _setUpExtension(self, plugin, service_type, def _setUpExtension(self, plugin, service_type,
resource_attribute_map, _resource_attribute_map,
extension_class, extension_class,
resource_prefix, plural_mappings=None, resource_prefix, plural_mappings=None,
translate_resource_name=False, translate_resource_name=False,
allow_pagination=False, allow_sorting=False, allow_pagination=False, allow_sorting=False,
supported_extension_aliases=None, supported_extension_aliases=None,
use_quota=False, use_quota=False):
): return self.setup_extension(
plugin, service_type,
extension_class,
resource_prefix, plural_mappings=None,
translate_resource_name=False,
allow_pagination=False, allow_sorting=False,
supported_extension_aliases=None,
use_quota=False)
def setup_extension(self, plugin, service_type,
extension_class,
resource_prefix, plural_mappings=None,
translate_resource_name=False,
allow_pagination=False, allow_sorting=False,
supported_extension_aliases=None,
use_quota=False):
self._resource_prefix = resource_prefix self._resource_prefix = resource_prefix
self._plural_mappings = plural_mappings or {} self._plural_mappings = plural_mappings or {}

View File

@ -52,10 +52,10 @@ class FlavorExtensionTestCase(extension.ExtensionTestCase):
def setUp(self): def setUp(self):
super(FlavorExtensionTestCase, self).setUp() super(FlavorExtensionTestCase, self).setUp()
self._setUpExtension( self.setup_extension(
'neutron.services.flavors.flavors_plugin.FlavorsPlugin', 'neutron.services.flavors.flavors_plugin.FlavorsPlugin',
constants.FLAVORS, {}, constants.FLAVORS, flavors.Flavors, '',
flavors.Flavors, '', supported_extension_aliases=['flavors']) supported_extension_aliases=['flavors'])
def test_create_flavor(self): def test_create_flavor(self):
tenant_id = uuidutils.generate_uuid() tenant_id = uuidutils.generate_uuid()

View File

@ -92,11 +92,10 @@ class L3NatExtensionTestCase(test_extensions_base.ExtensionTestCase):
def setUp(self): def setUp(self):
super(L3NatExtensionTestCase, self).setUp() super(L3NatExtensionTestCase, self).setUp()
self._setUpExtension( self.setup_extension(
'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin', 'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin',
plugin_constants.L3, {}, plugin_constants.L3, l3.L3, '', allow_pagination=True,
l3.L3, '', allow_pagination=True, allow_sorting=True, allow_sorting=True, supported_extension_aliases=['router'],
supported_extension_aliases=['router'],
use_quota=True) use_quota=True)
def test_router_create(self): def test_router_create(self):