def test_config_registers_fetcher_callback(self): c = Config() called = False def callback(): nonlocal called called = True c.register_fetcher_callback(callback) data = {'type': 'LocalFetcher', 'src': 'somecontext'} c.load_fetcher(data) self.assertTrue(called)
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()
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()
def test_config_loads_fetcher(self): c = Config() data = {'type': 'LocalFetcher', 'src': 'somecontext'} c.load_fetcher(data) self.assertEqual(data, c.get_fetcher())