当前位置: 首页>>代码示例>>Python>>正文


Python MimicCore.fromPlugins方法代码示例

本文整理汇总了Python中mimic.core.MimicCore.fromPlugins方法的典型用法代码示例。如果您正苦于以下问题:Python MimicCore.fromPlugins方法的具体用法?Python MimicCore.fromPlugins怎么用?Python MimicCore.fromPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mimic.core.MimicCore的用法示例。


在下文中一共展示了MimicCore.fromPlugins方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_from_plugin_includes_all_plugins

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
 def test_from_plugin_includes_all_plugins(self):
     """
     Using the :func:`MimicRoot.fromPlugin` creator for a
     :class:`MimicCore`, the nova and loadbalancer plugins are included.
     """
     core = MimicCore.fromPlugins(Clock())
     plugin_apis = set((
         glance_plugin.glance,
         loadbalancer_plugin.loadbalancer,
         loadbalancer_plugin.loadbalancer_control,
         maas_plugin.maas,
         maas_plugin.maas_control,
         nova_plugin.nova,
         nova_plugin.nova_control_api,
         queue_plugin.queue,
         rackconnect_v3_plugin.rackconnect,
         swift_plugin.swift,
         cloudfeeds_plugin.cloudfeeds,
         cloudfeeds_plugin.cloudfeeds_control,
     ))
     self.assertEqual(
         plugin_apis,
         set(core._uuid_to_api.values()))
     self.assertEqual(
         len(plugin_apis),
         len(list(core.entries_for_tenant('any_tenant', {},
                                          'http://mimic'))))
开发者ID:raghav3259,项目名称:mimic,代码行数:29,代码来源:test_core.py

示例2: test_load_domain_plugin_includes_all_domain_plugins

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
    def test_load_domain_plugin_includes_all_domain_plugins(self):
        """
        Using the :func:`MimicRoot.fromPlugin` creator for a
        :class:`MimicCore`, domain mocks implementing `class`:`IAPIDomainMock`
        are included.
        """
        self.root = FilePath(self.mktemp())
        self.root.createDirectory()
        plugin = b"""from mimic.test.dummy import ExampleDomainAPI
dummy_domain_plugin = ExampleDomainAPI()
"""
        self.root.child('fake_plugin.py').setContent(plugin)

        import mimic.plugins
        mimic.plugins.__path__.append(self.root.path)
        from mimic.plugins import fake_plugin

        def cleanup():
            sys.modules.pop("mimic.plugins.fake_plugin")
            del mimic.plugins.fake_plugin
        self.addCleanup(cleanup)

        core = MimicCore.fromPlugins(Clock())
        self.assertIn(
            fake_plugin.dummy_domain_plugin,
            core.domains
        )
开发者ID:rackerlabs,项目名称:mimic,代码行数:29,代码来源:test_core.py

示例3: test_from_plugin_includes_all_plugins

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
 def test_from_plugin_includes_all_plugins(self):
     """
     Using the :func:`MimicRoot.fromPlugin` creator for a
     :class:`MimicCore`, the nova and loadbalancer plugins are included.
     """
     core = MimicCore.fromPlugins(Clock())
     plugin_apis = set((
         glance_plugin.glance,
         heat_plugin.heat,
         loadbalancer_plugin.loadbalancer,
         loadbalancer_plugin.loadbalancer_control,
         maas_plugin.maas,
         maas_plugin.maas_control,
         nova_plugin.nova,
         nova_plugin.nova_control_api,
         queue_plugin.queue,
         rackconnect_v3_plugin.rackconnect,
         swift_plugin.swift,
         cloudfeeds_plugin.cloudfeeds,
         cloudfeeds_plugin.cloudfeeds_control,
         neutron_plugin.neutron,
         dns_plugin.dns,
         cinder_plugin.cinder
     ))
     # all plugins should be on the internal listing
     self.assertEqual(
         plugin_apis,
         set(core._uuid_to_api_internal.values()))
     # the external listing should still be empty
     self.assertEqual(
         set([]),
         set(core._uuid_to_api_external.values()))
开发者ID:rackerlabs,项目名称:mimic,代码行数:34,代码来源:test_core.py

示例4: makeService

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
def makeService(config):
    """
    Set up the otter-api service.
    """
    s = MultiService()
    core = MimicCore.fromPlugins(Clock())
    root = MimicRoot(core)
    site = Site(root.app.resource())
    site.displayTracebacks = False
    service(config['listen'], site).setServiceParent(s)
    return s
开发者ID:jirwin,项目名称:mimic,代码行数:13,代码来源:tap.py

示例5: test_from_plugin_includes_all_plugins

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
 def test_from_plugin_includes_all_plugins(self):
     """
     Using the :func:`MimicRoot.fromPlugin` creator for a
     :class:`MimicCore`, the nova and loadbalancer plugins are included.
     """
     core = MimicCore.fromPlugins(Clock())
     self.assertEqual(
         set((nova_plugin.nova, loadbalancer_plugin.loadbalancer)),
         set(core._uuid_to_api.values()))
     self.assertEqual(
         2, len(list(core.entries_for_tenant('any_tenant', {},
                                             'http://mimic'))))
开发者ID:kivattik,项目名称:mimic,代码行数:14,代码来源:test_core.py

示例6: makeService

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
def makeService(config):
    """
    Set up the otter-api service.
    """
    s = MultiService()
    if config['realtime']:
        from twisted.internet import reactor as clock
    else:
        clock = Clock()
    core = MimicCore.fromPlugins(clock)
    root = MimicRoot(core, clock)
    site = get_site(root.app.resource(), logging=bool(config['verbose']))
    service(config['listen'], site).setServiceParent(s)
    return s
开发者ID:BenjamenMeyer,项目名称:mimic,代码行数:16,代码来源:tap.py

示例7: makeService

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
def makeService(config):
    """
    Set up the otter-api service.
    """
    s = MultiService()
    if config['realtime']:
        from twisted.internet import reactor as clock
    else:
        clock = Clock()
    core = MimicCore.fromPlugins(clock)
    root = MimicRoot(core, clock)
    site = Site(root.app.resource())
    site.displayTracebacks = False
    service(config['listen'], site).setServiceParent(s)
    return s
开发者ID:amitgandhinz,项目名称:mimic,代码行数:17,代码来源:tap.py

示例8: startMimic

# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import fromPlugins [as 别名]
def startMimic():
    """
    Setup the mimic application using steps similar to
    :obj:`mimic.tap.makeService' and start listening for requests.
    """
    clock = Clock()
    core = MimicCore.fromPlugins(clock)
    root = MimicRoot(core, clock)
    site = Site(root.app.resource())
    site.displayTracebacks = False

    endpoint = serverFromString(
        reactor,
        b"tcp:{0}:interface=127.0.0.1".format(_PORT)
    )
    endpoint.listen(site)
开发者ID:derwolfe,项目名称:mimic,代码行数:18,代码来源:start-app.py


注:本文中的mimic.core.MimicCore.fromPlugins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。