當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。