#!/usr/bin/env python import unittest, sys from ZSI import * class t7TestCase(unittest.TestCase): "Test case wrapper for old ZSI t7 test case" def checkt7(self): ps = ParsedSoap(text) tcdict = TC.Apache.Map('c-gensym1') tclist = TC.Apache.Map('c-gensym1', aslist=1) d = tcdict.parse(ps.body_root, ps) self.assertEqual(d, { u'a':123, '\x00\x01':456 }) print 'as dictionary\n', d l = tclist.parse(ps.body_root, ps) self.assertEqual(l, [('\x00\x01', 456), (u'a', 123)]) print '\n', '=' * 30 print 'as list\n', l print '\n', '=' * 30 sw = SoapWriter() sw.serialize(d, tcdict) print >>sys.stdout, sw print '\n', '=' * 30 sw = SoapWriter() sw.serialize(l, tclist) print >>sys.stdout, sw def makeTestSuite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(t7TestCase, "check")) return suite def main(): unittest.main(defaultTest="makeTestSuite") text = ''' AAE= 456 a 123 ''' if __name__ == "__main__" : main()