def test_sql_result(self): sr = GenQueryResponseColumn() sr.attriInx = 504 sr.reslen = 64 sr.value = ["one", "two"] expected = "<SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI>" self.assertEqual(sr.pack(), expected) sr2 = GenQueryResponseColumn() sr2.unpack(ET().fromstring(expected)) self.assertEqual(sr2.attriInx, 504) self.assertEqual(sr2.reslen, 64) self.assertEqual(sr2.value, ["one", "two"]) self.assertEqual(sr2.pack(), expected)
def test_sql_result(self): sr = GenQueryResponseColumn() sr.attriInx = 504 sr.reslen = 64 sr.value = ["one", "two"] expected = "<SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI>" self.assertEqual(sr.pack(), expected) sr2 = GenQueryResponseColumn() sr2.unpack(ET.fromstring(expected)) self.assertEqual(sr2.attriInx, 504) self.assertEqual(sr2.reslen, 64) self.assertEqual(sr2.value, ["one", "two"]) self.assertEqual(sr2.pack(), expected)
def test_gen_query_out(self): gqo = GenQueryResponse() gqo.rowCnt = 2 gqo.attriCnt = 2 gqo.continueInx = 5 gqo.totalRowCount = 7 sr = GenQueryResponseColumn() sr.attriInx = 504 sr.reslen = 64 sr.value = ["one", "two"] gqo.SqlResult_PI = [sr, sr] expected = "<GenQueryOut_PI><rowCnt>2</rowCnt><attriCnt>2</attriCnt><continueInx>5</continueInx><totalRowCount>7</totalRowCount><SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI><SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI></GenQueryOut_PI>" self.assertEqual(gqo.pack(), expected) gqo2 = GenQueryResponse() gqo2.unpack(ET().fromstring(expected)) self.assertEqual(gqo2.rowCnt, 2) self.assertEqual(gqo2.pack(), expected)
def test_gen_query_out(self): gqo = GenQueryResponse() gqo.rowCnt = 2 gqo.attriCnt = 2 gqo.continueInx = 5 gqo.totalRowCount = 7 sr = GenQueryResponseColumn() sr.attriInx = 504 sr.reslen = 64 sr.value = ["one", "two"] gqo.SqlResult_PI = [sr, sr] expected = "<GenQueryOut_PI><rowCnt>2</rowCnt><attriCnt>2</attriCnt><continueInx>5</continueInx><totalRowCount>7</totalRowCount><SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI><SqlResult_PI><attriInx>504</attriInx><reslen>64</reslen><value>one</value><value>two</value></SqlResult_PI></GenQueryOut_PI>" self.assertEqual(gqo.pack(), expected) gqo2 = GenQueryResponse() gqo2.unpack(ET.fromstring(expected)) self.assertEqual(gqo2.rowCnt, 2) self.assertEqual(gqo2.pack(), expected)