def split_params(self, params): if not isinstance(params, str): raise AssertionError('Parameters can only be a string, received %s' % type(params)) try: return split_routeros_command(params) except ParseError as e: self.module.fail_json(msg=to_native(e))
def test_roundtrip(dictionary): argument_list = ['%s=%s' % (k, v) for k, v in dictionary.items()] command = join_routeros_command(argument_list) resplit_list = split_routeros_command(command) print(resplit_list, argument_list) assert resplit_list == argument_list re_dictionary = convert_list_to_dictionary(resplit_list) print(re_dictionary, dictionary) assert re_dictionary == dictionary
def test_split_routeros_command_errors(command, message): with pytest.raises(ParseError) as exc: split_routeros_command(command) print(exc.value.args[0], message) assert exc.value.args[0] == message
def test_split_routeros_command(command, result): result_ = split_routeros_command(command) print(result_, result) assert result_ == result