Exemple #1
0
    def setUp(self):
        super(ExtensionExtendedAttributeTestCase, self).setUp()
        plugin = ("tacker.tests.unit.test_extension_extended_attribute."
                  "ExtensionExtendedAttributeTestPlugin")

        # point config file to: tacker/tests/etc/tacker.conf.test
        self.config_parse()

        self.setup_coreplugin(plugin)

        ext_mgr = extensions.ExtensionManager(extensions_path)
        ext_mgr.extend_resources("1.0", {})
        extensions.ExtensionManager._instance = ext_mgr

        app = config.load_paste_app('extensions_test_app')
        self._api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)

        self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1"
        # Save the global RESOURCE_ATTRIBUTE_MAP
        self.saved_attr_map = {}
        for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
            self.saved_attr_map[resource] = attrs.copy()
        # Add the resources to the global attribute map
        # This is done here as the setup process won't
        # initialize the main API router which extends
        # the global attribute map
        attributes.RESOURCE_ATTRIBUTE_MAP.update(
            extattr.EXTENDED_ATTRIBUTES_2_0)
        self.agentscheduler_dbMinxin = manager.TackerManager.get_plugin()
        self.addCleanup(self.restore_attribute_map)
def setup_extensions_middleware(extension_manager=None):
    extension_manager = (extension_manager
                         or extensions.ExtensionManager(extensions_path))
    base.BaseTestCase.config_parse()
    app = config.load_paste_app('extensions_test_app')
    return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)