def test_mapping_config(self): konfig = config.MappingConfig(config.from_yaml(CFG_FILE)) self.assertEqual(konfig.inputs, INPUTS) self.assertEqual(konfig.inspectors, INSPECTORS) self.assertEqual(konfig.transformers, TRANSFORMERS) self.assertEqual(konfig.outputs, SUBSCRIBERS) self.assertEqual(konfig.pipes, PIPES)
def main(): # handle cmd-line arguments args = docopt(__doc__, version='Jetstreamer cli 1.0') # parse configuration cfgpth = args["--config"] or os.getcwd() + os.sep + "config.yaml" cfg = from_yaml(cfgpth) # handle commands if args["--log"]: print("setting log level to %s" % args["--log"]) logger.setLevel(getattr(logging, args["--log"])) if args["list"]: names = MappingConfig(cfg).pipes.keys() print("Configured pipes: '" + "', '".join(names) + "'") sys.exit() if args["run"] and args["<pipename>"]: s = Streamer(args["<pipename>"], cfg) for record in s: print(record)
def test_load_url(self): mapping = config.from_yaml(CFG_URL) self.assertEqual(sorted(SECTIONS), sorted(list(mapping.keys())))