def test_convertoxml(self): path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "docker_inspect_json.xml") with open(path) as filehandler: filecontents = simplejson.load(filehandler) xmloutput = util.converttoxml({'docker_inspect': filecontents}) xml.dom.minidom.parseString(xmloutput)
def test_convertoxml(self): path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "docker_inspect_json.xml") with open(path) as filehandler: filecontents = util.convert_dict_to_ascii(json.load(filehandler)) xmloutput = util.converttoxml({'docker_inspect': filecontents}) xml.dom.minidom.parseString(xmloutput)
def test_nested_list_convert(self): rec = {'ports': [ {'IP': '0.0.0.0'}, {'IP': '0.0.0.1'}, ]} expected_xml = ('<?xml version="1.0" ?><ports><item><IP>0.0.0.0</IP>' + '</item><item><IP>0.0.0.1</IP></item></ports>') xmloutput = util.converttoxml(rec) print xmloutput self.assertEqual(xmloutput, expected_xml)
def test_nested_list_convert(self): rec = {'ports': [ {'IP': '0.0.0.0'}, {'IP': '0.0.0.1'}, ]} expected_xml = ('<?xml version="1.0" ?><ports><item><IP>0.0.0.0</IP>' + '</item><item><IP>0.0.0.1</IP></item></ports>') xmloutput = util.converttoxml(rec) print(xmloutput) self.assertEqual(xmloutput, expected_xml)
def get_top_xml(session, vmuuid, container): result = {'docker_top': get_top_dict(session, vmuuid, container)} return util.converttoxml(result)
def get_inspect_xml(session, vmuuid, container): result = {'docker_inspect': get_inspect_dict(session, vmuuid, container)} return util.converttoxml(result)
def get_version_xml(session, vmuuid): result = {'docker_version': get_version_dict(session, vmuuid)} return util.converttoxml(result)
def get_info_xml(session, vmuuid): result = {'docker_info': get_info_dict(session, vmuuid)} return util.converttoxml(result)
def get_top_xml(session, vmuuid, container): result = {'docker_top': get_top_dict(session, vmuuid, container)} return util.converttoxml(result)
def get_inspect_xml(session, vmuuid, container): result = {'docker_inspect': get_inspect_dict(session, vmuuid, container)} return util.converttoxml(result)
def get_version_xml(session, vmuuid): result = {'docker_version': get_version_dict(session, vmuuid)} return util.converttoxml(result)
def get_info_xml(session, vmuuid): result = {'docker_info': get_info_dict(session, vmuuid)} return util.converttoxml(result)