def test_split_key_value_pair(stc): ctor = CScriptableCreator() cmd = ctor.CreateCommand(PKG + ".MethodologyGroupCommand") MethGrp.get_this_cmd = MagicMock(return_value=cmd) k, v = MethGrp.split_key_value_pair("Any.sort:of.key=value") assert k == 'Any.sort:of.key' assert v == 'value' k, v = MethGrp.split_key_value_pair("Any.sort:of.key=value=morevalue") assert k == 'Any.sort:of.key' assert v == 'value=morevalue' return
def test_load_xmlroot_from_file(stc): ctor = CScriptableCreator() cmd = ctor.CreateCommand(PKG + ".MethodologyGroupCommand") MethGrp.get_this_cmd = MagicMock(return_value=cmd) filename = "test_MethodologyGroupCommand_2.xml" try: with open(filename, "w") as f: f.write('<root id="3"/>') root = MethGrp.load_xmlroot_from_file("test_MethodologyGroupCommand_2.xml") assert root is not None assert len(root.findall('.//')) == 0 assert root.Get('id') == '3' assert root.Get('name') == 'root' finally: os.remove(filename) return