Ejemplo n.º 1
0
    def test_loading_from_config(self):
        config = Config(StringIO(dedent("""
        [test1]
        enabled=true
        backend = mozsvc.metrics.MetlogPlugin
        sender_class=metlog.senders.ZmqPubSender
        sender_bindstrs=tcp://localhost:5585
                        tcp://localhost:5586

        [test2]
        dontusethis =  seriously
        """)))
        settings = {"config": config}
        plugin = load_from_config("test1", config)
        config = Configurator(settings=settings)
        config.commit()
        self.failUnless(isinstance(plugin, MetlogPlugin))
        self.failUnless(isinstance(plugin.client, MetlogClient))
        self.failUnless(isinstance(plugin.client.sender, ZmqPubSender))

        client = plugin.client
        sender = client.sender

        self.assertEquals(sender.bindstrs, \
                ['tcp://localhost:5585', 'tcp://localhost:5586'])
Ejemplo n.º 2
0
 def setUp(self):
     config = Config(StringIO(dedent("""
     [test1]
     backend = mozsvc.metrics.MetlogPlugin
     sender_class=metlog.senders.DebugCaptureSender
     """)))
     settings = {"config": config}
     self.plugin = load_from_config("test1", config)
     config = Configurator(settings=settings)
     config.commit()
 def setUp(self):
     config = Config(StringIO(dedent("""
     [test1]
     enabled=true
     backend = mozsvc.metrics.MetlogPlugin
     sender_class=metlog.senders.DebugCaptureSender
     disable_timeit=true
     """)))
     settings = {"config": config}
     config = Configurator(settings=settings)
     self.plugin = load_and_register("test1", config)
     config.commit()
 def setUp(self):
     if not metlog:
         raise(unittest2.SkipTest('no metlog'))
     self.orig_globals = CLIENT_HOLDER.global_config.copy()
     config = Config(StringIO(dedent("""
     [test1]
     backend = mozsvc.metrics.MetlogPlugin
     logger = test
     sender_class=metlog.senders.DebugCaptureSender
     global_disabled_decorators = timeit
                                  something
     """)))
     settings = {"config": config}
     config = Configurator(settings=settings)
     self.plugin = load_and_register("test1", config)
     config.commit()
Ejemplo n.º 5
0
 def setUp(self):
     if not metlog:
         raise (unittest2.SkipTest('no metlog'))
     self.orig_globals = CLIENT_HOLDER.global_config.copy()
     config = Config(
         StringIO(
             dedent("""
     [test1]
     backend = mozsvc.metrics.MetlogPlugin
     logger = test
     sender_class=metlog.senders.DebugCaptureSender
     global_disabled_decorators = timeit
                                  something
     """)))
     settings = {"config": config}
     config = Configurator(settings=settings)
     self.plugin = load_and_register("test1", config)
     config.commit()
Ejemplo n.º 6
0
 def test_loading_from_config(self):
     config = Config(StringIO(dedent("""
     [test1]
     backend = mozsvc.tests.test_plugin.Test1
     arg1 = 1
     hello = world
     [test2]
     dontusethis =  seriously
     """)))
     settings = {"config": config}
     config = Configurator(settings=settings)
     plugin = load_and_register("test1", config)
     config.commit()
     self.failUnless(verifyObject(ITest1, plugin))
     self.failUnless(isinstance(plugin, Test1))
     self.assertEquals(plugin.kwds["arg1"], 1)
     self.assertEquals(plugin.kwds["hello"], "world")
     self.assertEquals(len(plugin.kwds), 2)
     self.failUnless(config.registry.queryUtility(ITest1) is plugin)
Ejemplo n.º 7
0
 def test_loading_from_config(self):
     config = Config(
         StringIO(
             dedent("""
     [test1]
     backend = mozsvc.tests.test_plugin.Test1
     arg1 = 1
     hello = world
     [test2]
     dontusethis =  seriously
     """)))
     settings = {"config": config}
     config = Configurator(settings=settings)
     plugin = load_and_register("test1", config)
     config.commit()
     self.assertTrue(verifyObject(ITest1, plugin))
     self.assertTrue(isinstance(plugin, Test1))
     self.assertEqual(plugin.kwds["arg1"], 1)
     self.assertEqual(plugin.kwds["hello"], "world")
     self.assertEqual(len(plugin.kwds), 2)
     self.assertTrue(config.registry.queryUtility(ITest1) is plugin)