def test_available_sel_xml(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) el = MYSQLDataBase() self.assertTrue(isinstance(el, object)) self.connect(el) avc = el.availableSelections() self.assertTrue(isinstance(avc, list)) name = "mcs_test_selection" xml = "<?xml version='1.0'?><definition><group type='NXentry'/>" \ + "</definition>" while name in avc: name = name + '_1' # print(avc cpx = el.selections(avc) self.assertEqual(el.storeSelection(name, xml), None) self.__cmps.append(name) avc2 = el.availableSelections() # print(avc2 cpx2 = el.selections(avc2) self.assertTrue(isinstance(avc2, list)) for i in range(len(avc)): self.assertTrue(avc[i] in avc2) j = avc2.index(avc[i]) self.assertEqual(cpx2[j], cpx[i]) self.assertTrue(name in avc2) j = avc2.index(name) self.assertEqual(cpx2[j], xml) self.assertEqual(el.deleteSelection(name), None) self.__cmps.pop() avc3 = el.availableSelections() cpx3 = el.selections(avc3) self.assertTrue(isinstance(avc3, list)) for i in range(len(avc)): self.assertTrue(avc[i] in avc3) j = avc3.index(avc[i]) self.assertEqual(cpx3[j], cpx[i]) self.assertTrue(name not in avc3) self.assertEqual(long(el.version()), self.version) self.assertEqual(el.close(), None)
def test_available_sel_strange_name(self): fun = sys._getframe().f_code.co_name print("Run: %s.%s() " % (self.__class__.__name__, fun)) el = MYSQLDataBase() self.assertTrue(isinstance(el, object)) self.connect(el) avc = el.availableSelections() self.assertTrue(isinstance(avc, list)) name = "mcs_test_selection\\ \' \" \\\" \\\\" xml = "<?xml version='1.0'?><definition>\\ \' \" \\\" " \ + "\\\\<group type='NXentry'/></definition>" while name in avc: name = name + '_1' # print(avc self.assertEqual(el.storeSelection(name, xml), None) self.assertEqual(el.storeSelection(name, xml), None) self.__cmps.append(name) avc2 = el.availableSelections() # print(avc2 self.assertTrue(isinstance(avc2, list)) for cp in avc: self.assertTrue(cp in avc2) self.assertTrue(name in avc2) cpx = el.selections([name]) self.assertEqual(cpx[0], xml) self.assertEqual(el.deleteSelection(name), None) self.__cmps.pop() avc3 = el.availableSelections() self.assertTrue(isinstance(avc3, list)) for cp in avc: self.assertTrue(cp in avc3) self.assertTrue(name not in avc3) self.assertEqual(long(el.version()), self.version) self.assertEqual(el.close(), None)