def test_retrieve_command_as_list(self): template = "{/timers/@text} {/@text}" path = '/protocols/ospf/freq' syntax = {path: template} v = VyattaJSONParser({}, syntax) actual = list(v.retrieve_commands(path)) expected = [template] self.assertEqual(actual, expected)
def test_retrieve_command_escape_dots(self): template = "{/../timers/@text}" path = '/protocols/ospf/freq' syntax = {path: template} v = VyattaJSONParser({}, syntax) actual = list(v.retrieve_commands(path)) expected = ["{{/{}/timers/@text}}".format(DIR_TRAVERSE_UP_LABEL)] self.assertEqual(actual, expected)