def test_full_command_quote(): """ Test the full_command_quote function """ assert "command" == full_command_quote('command') assert "a 'b' 'c'" == full_command_quote('a', ['b', 'c']) assert "safe" == full_command_quote('safe', []) assert "a command 'with' 'unsafe '\\''argument'\\'''" == \ full_command_quote("a command", ["with", "unsafe 'argument'"])
def cmd(self, cmd_name, args=[]): """ Execute a command string, escaping it, if necessary """ return self.internal_cmd(full_command_quote(cmd_name, args))