def test_fault(self): inMessage = Message('fault',[]) outMessage = Message('faultResponse',[]) desc = MethodDescriptor('fault','fault',inMessage,outMessage,'') client = SimpleSoapClient('127.0.0.1:9191','/',desc) try: client() except Fault, f: self.assertEquals(f.faultcode,'faultFault') self.assertEquals(f.faultstring,'Testing faults')
def _test_callback(self): inputs = [ParameterDescriptor('person',Person)] client = SimpleSoapClient('127.0.0.1:9191','/','e',inputs,None) p = Person() p.name = 'wilson' r = client(p) self.assertEquals(r,None)
def test_simple(self): inMessage = Message('a',[('s',String),('i',Integer)]) outMessage = Message('aResponse',[('retval',DateTime)]) desc = MethodDescriptor('a','a',inMessage,outMessage,'') client = SimpleSoapClient('127.0.0.1:9191','/',desc) results = client('abc',54) self.assertEquals(results,datetime.datetime(1901,12,15))
def test_async(self): inMessage = Message('d',[('person',Person)]) outMessage = Message('dResponse',[]) desc = MethodDescriptor('d','d',inMessage,outMessage,'') client = SimpleSoapClient('127.0.0.1:9191','/',desc) p = Person() p.name = 'wilson' r = client(p) self.assertEquals(r,None)
def test_nested(self): inMessage = Message('b',[('p',Person),('s',String),('a',Integer)]) outMessage = Message('bResponse',[('retval',Address)]) desc = MethodDescriptor('b','b',inMessage,outMessage,'') client = SimpleSoapClient('127.0.0.1:9191','/',desc) p = Person() p.name = 'wilson' p.addresses = [] for i in range(0,123): a = Address() a.zip = i p.addresses.append(a) res = client(p,'abc',123) self.assertEquals(res.longitude,None) self.assertEquals(res.zip,4444) self.assertEquals(res.street,'wsgi way')