[Zope-CVS] CVS: Packages/WebService/tests - testSOAPTypes.py:1.1
Brian Lloyd
brian@digicool.com
Mon, 17 Dec 2001 10:01:42 -0500
Update of /cvs-repository/Packages/WebService/tests
In directory cvs.zope.org:/tmp/cvs-serv24018/tests
Added Files:
testSOAPTypes.py
Log Message:
Added beginnings of Serializer module docs
=== Added File Packages/WebService/tests/testSOAPTypes.py ===
__version__='$Revision: 1.1 $'[11:-2]
import sys, os, string, unittest, testcase
class SOAPTypesTests(testcase.TestCase):
"""Test the type handling utilities provided by SOAPTypes."""
def testSOAPStruct(self):
"""Test the SOAPStruct interfaces."""
from WebService.SOAPTypes import SOAPStruct
struct1 = SOAPStruct('ContactList')
for i in range(10):
item = SOAPStruct('Contact')
item.fullname = 'Person %d' % i
item.address = '123 Main Street'
item.city = 'Hollywood'
item.zipcode = '90210'
struct1.addMember('Contact', item)
struct2 = SOAPStruct('ContactList')
for i in range(10):
item = SOAPStruct('Contact')
item.addMember('fullname', 'Person %d' % i)
item.addMember('address', '123 Main Street')
item.addMember('city', 'Hollywood')
item.addMember('zipcode', '90210')
struct2.addMember('Contact', item)
for struct in (struct1, struct2):
for i in range(10):
item = struct[i]
person = 'Person %d' % i
self.assertEquals(item.fullname, person)
self.assertEquals(item.get('fullname'), person)
self.assertEquals(item['fullname'], person)
self.assertEquals(item[0], person)
self.assertEquals(item.address, '123 Main Street')
self.assertEquals(item.get('address'), '123 Main Street')
self.assertEquals(item['address'], '123 Main Street')
self.assertEquals(item[1], '123 Main Street')
self.assertEquals(item.city, 'Hollywood')
self.assertEquals(item.get('city'), 'Hollywood')
self.assertEquals(item['city'], 'Hollywood')
self.assertEquals(item[2], 'Hollywood')
self.assertEquals(item.zipcode, '90210')
self.assertEquals(item.get('zipcode'), '90210')
self.assertEquals(item['zipcode'], '90210')
self.assertEquals(item[3], '90210')
def test_suite():
return unittest.makeSuite(SOAPTypesTests)
def main():
unittest.TextTestRunner().run(test_suite())
if __name__ == '__main__':
testcase.setup()
main()