Ejemplo n.º 1
0
    def test_config_registers_publisher_callback(self):
        c = Config()
        called = False

        def callback():
            nonlocal called
            called = True
        c.register_publisher_callback(callback)
        data = {'type': 'LocalPublisher', 'dest': 'somecontext'}
        c.load_publisher(data)
        self.assertTrue(called)
Ejemplo n.º 2
0
 def test_runner_gets_fetcher_and_publisher(self, create_context,
                                            fetcher_update):
     c = Config()
     r = Runner(c)
     p_config = {'type': 'LocalPublisher', 'dest': 'testcases'}
     c.load_publisher(p_config)
     f_config = {'type': 'LocalFetcher', 'src': 'testcases'}
     c.load_fetcher(f_config)
     self.assertEqual({'src': 'str'}, r.fetcher.meta())
     self.assertEqual({'dest': 'str'}, r.publisher.meta())
     create_context.assert_called_once()
     fetcher_update.assert_called_once()
Ejemplo n.º 3
0
 def test_runner_inits(self, fetcher_update):
     c = Config()
     r = Runner(c)
     self.assertEqual(None, r.fetcher)
     self.assertEqual(None, r.publisher)
     fetcher_update.assert_not_called()
     p_config = {'type': 'LocalPublisher', 'dest': 'testcases'}
     c.load_publisher(p_config)
     f_config = {'type': 'LocalFetcher', 'src': 'testcases'}
     c.load_fetcher(f_config)
     fetcher_update.assert_called_once()
     self.assertEqual(f_config, r.config.get_fetcher())
     self.assertEqual(p_config, r.config.get_publisher())
     r.cleanup()
Ejemplo n.º 4
0
 def test_config_loads_publisher(self):
     c = Config()
     data = {'type': 'LocalPublisher', 'src': 'somecontext'}
     c.load_publisher(data)
     self.assertEqual(data, c.get_publisher())