def test_invalid_conf(self, tmpdir): tmpfile = TestParseConfig.write_config(tmpdir, TestParseConfig.invalid_conf) parse = parser.create_parser() args = parse.parse_args(['-c', tmpfile, 'create']) with pytest.raises(Exception) as ex: utils.parse_config(args, configuration.Configuration()) assert ex
def test_missing_tasks(self, tmpdir): tmpfile = TestParseConfig.write_config(tmpdir, TestParseConfig.cluster_block + TestParseConfig.machines_block + TestParseConfig.scenario_block) parse = parser.create_parser() args = parse.parse_args(['-c', tmpfile, 'create']) with pytest.raises(SystemExit) as ex: utils.parse_config(args, configuration.Configuration()) assert str(ex.value) == "1"
def test_valid_config(self, tmpdir): tmpfile = TestParseConfig.write_config(tmpdir, TestParseConfig.cluster_block + TestParseConfig.machines_block + TestParseConfig.scenario_block + TestParseConfig.tasks_block) parse = parser.create_parser() args = parse.parse_args(['-c', tmpfile, 'create']) config = utils.parse_config(args, configuration.Configuration()) assert config.conf == TestParseConfig.conf_machines assert config.forwards == TestParseConfig.conf_forwards assert config.tasks == TestParseConfig.conf_tasks