Add more list corner cases to test the soap behavior with empty arrays

This commit is contained in:
Christophe de Vienne 2012-09-13 23:13:41 +02:00
parent b8de4600e0
commit 1512c3902f
2 changed files with 31 additions and 0 deletions

View File

@ -10,5 +10,23 @@ print client.service.multiply(4, 5)
print client.service.helloworld()
print client.service.getperson()
p = client.service.listpersons()
print repr(p)
p = client.service.setpersons(p)
print repr(p)
p = client.factory.create('ns0:Person')
p.id = 4
print p
a = client.factory.create('ns0:Person_Array')
print a
a = client.service.setpersons(a)
print repr(a)
a.item.append(p)
print repr(a)
a = client.service.setpersons(a)
print repr(a)

View File

@ -26,6 +26,15 @@ class Person(object):
firstname = unicode
lastname = unicode
hobbies = [unicode]
def __repr__(self):
return "Person(%s, %s %s, %s)" % (
self.id,
self.firstname, self.lastname,
self.hobbies
)
class DemoRoot(WSRoot):
@expose(int)
@ -48,6 +57,8 @@ class DemoRoot(WSRoot):
p.id = 12
p.firstname = u'Ross'
p.lastname = u'Geler'
p.hobbies = []
print p
return p
@expose([Person])
@ -62,6 +73,7 @@ class DemoRoot(WSRoot):
p.firstname = u('Rachel')
p.lastname = u('Green')
r.append(p)
print r
return r
@expose(Person)
@ -72,6 +84,7 @@ class DemoRoot(WSRoot):
@expose([Person])
@validate([Person])
def setpersons(self, persons):
print persons
return persons