def test_list_basic(self, args_parser, mocked_config, capsys): args = args_parser.parse_args(self.default_parser_args) list_groups(args) captured = capsys.readouterr() parsed_groups = self.extract_groups(captured.out) assert parsed_groups self.compare_parsed_groups_with_complete(parsed_groups, mocked_config)
def test_list_empty(self, args_parser, mocked_config, capsys): args = args_parser.parse_args(self.default_parser_args) mocked_config["groups"]["test"]["hosts"] = [] list_groups(args) captured = capsys.readouterr() parsed_groups = self.extract_groups(captured.out) assert parsed_groups assert not parsed_groups["test"]
def test_list_one_host(self, args_parser, mocked_config, capsys): args = args_parser.parse_args(self.default_parser_args) mocked_config["groups"]["test"]["hosts"] = ["matching"] list_groups(args) captured = capsys.readouterr() parsed_groups = self.extract_groups(captured.out) assert parsed_groups self.compare_parsed_groups_with_complete(parsed_groups, mocked_config)
def list_and_compare(self, args, mocked_config, capsys): list_groups(args) captured = capsys.readouterr() parsed_groups = self.extract_groups(captured.out) assert parsed_groups self.compare_parsed_groups_with_complete(parsed_groups, mocked_config)