def test_config_set_key_typo(self): try: od_pref.set_config(args=['webhook_typo', 'whatever']) except SystemExit: pass context = od_pref.load_context() self.assertNotIn('webhook_typo', context.config)
def test_config_set_valid(self): for arg in (('webhook_type', 'direct'), ('webhook_port', 0), ('logfile_path', self.tempdir.name + '/test.log')): try: od_pref.set_config(args=[str(v) for v in arg]) except SystemExit: pass context = od_pref.load_context() self.assertEqual(arg[1], context.config[arg[0]])
def test_config_set_invalid_str(self): for arg in (('webhook_type', 'whatever'), ('logfile_path', '/'), ('webhook_port', 70000), ('num_workers', 0)): try: od_pref.set_config(args=[str(v) for v in arg]) except SystemExit: pass context = od_pref.load_context() self.assertNotEqual(arg[1], context.config[arg[0]])