Package tests :: Module public
[hide private]
[frames] | no frames]

Source Code for Module tests.public

  1  # This program is free software; you can redistribute it and/or modify 
  2  # it under the terms of the (LGPL) GNU Lesser General Public License as 
  3  # published by the Free Software Foundation; either version 3 of the  
  4  # License, or (at your option) any later version. 
  5  # 
  6  # This program is distributed in the hope that it will be useful, 
  7  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
  8  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  9  # GNU Library Lesser General Public License for more details at 
 10  # ( http://www.gnu.org/licenses/lgpl.html ). 
 11  # 
 12  # You should have received a copy of the GNU Lesser General Public License 
 13  # along with this program; if not, write to the Free Software 
 14  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
 15  # written by: Jeff Ortel ( jortel@redhat.com ) 
 16   
 17  import sys 
 18  sys.path.append('../') 
 19   
 20  import logging 
 21  import traceback as tb 
 22  import suds.metrics as metrics 
 23  from tests import * 
 24  from suds import WebFault 
 25  from suds.client import Client 
 26   
 27  errors = 0 
 28   
 29  setup_logging() 
 30   
 31  #logging.getLogger('suds.client').setLevel(logging.DEBUG) 
 32  #logging.getLogger('suds.metrics').setLevel(logging.DEBUG) 
 33  #logging.getLogger('suds').setLevel(logging.DEBUG) 
 34   
 35   
36 -def start(url):
37 global errors 38 print '\n________________________________________________________________\n' 39 print 'Test @ ( %s ) %d' % (url, errors)
40 41 try: 42 url = 'http://mssoapinterop.org/asmx/simple.asmx?WSDL' 43 start(url) 44 client = Client(url) 45 print client 46 # string 47 input = "42" 48 d = dict(inputString=input) 49 result = client.service.echoString(**d) 50 print 'echoString() = %s' % result 51 assert result == input 52 # int 53 input = 42 54 result = client.service.echoInteger(input) 55 print 'echoInteger() = %s' % result 56 assert result == input 57 # float 58 input = 4.2 59 result = client.service.echoFloat(input) 60 print 'echoFloat() = %s' % result 61 assert result == input 62 # suds 0.3.8+ 63 result = client.service.echoIntegerArray([]) 64 print 'echoIntegerArray() = %s' % result 65 assert result is None 66 input = [1,2,3,4] 67 result = client.service.echoIntegerArray(input) 68 print 'echoIntegerArray() = %s' % result 69 assert result == input 70 result = client.service.echoIntegerArray(inputIntegerArray=input) 71 print 'echoIntegerArray() = %s' % result 72 assert result == input 73 except WebFault, f: 74 errors += 1 75 print f 76 print f.fault 77 except Exception, e: 78 errors += 1 79 print e 80 tb.print_exc() 81 82 try: 83 url = 'http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl' 84 start(url) 85 client = Client(url) 86 print client 87 token = client.service.login('soaptester', 'soaptester') 88 print 'token="%s"' % token 89 user = client.service.getUser(token, 'soaptester') 90 print 'user="%s"' % user 91 except WebFault, f: 92 errors += 1 93 print f 94 print f.fault 95 except Exception, e: 96 errors += 1 97 print e 98 tb.print_exc() 99 100 try: 101 url = 'http://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl' 102 start(url+' ** cloned **') 103 client = Client(url).clone() 104 print '**clone**\n%s' % client 105 token = client.service.login('soaptester', 'soaptester') 106 print '**clone** token="%s"' % token 107 user = client.service.getUser(token, 'soaptester') 108 print '**clone** user="%s"' % user 109 except WebFault, f: 110 errors += 1 111 print f 112 print f.fault 113 except Exception, e: 114 errors += 1 115 print e 116 tb.print_exc() 117 118 try: 119 url = ' http://www.boyzoid.com/comp/randomQuote.cfc?wsdl ' 120 start(url) 121 client = Client(url) 122 print client 123 print client.service.getQuote(False) 124 except WebFault, f: 125 errors += 1 126 print f 127 print f.fault 128 except Exception, e: 129 errors += 1 130 print e 131 tb.print_exc() 132 133 try: 134 url = 'http://www.zenfolio.com/zf/api/zfapi.asmx?wsdl' 135 start(url) 136 client = Client(url) 137 print client 138 #client.setport(0) 139 group = client.factory.create('Group') 140 print 'Group:\n%s' % group 141 print 'LoadGroupHierarchy("demo")' 142 groupHierarchy = client.service.LoadGroupHierarchy("demo") 143 print 'result:\n%s' % groupHierarchy 144 except WebFault, f: 145 errors += 1 146 print f 147 print f.fault 148 except Exception, e: 149 errors += 1 150 print e 151 tb.print_exc() 152 153 try: 154 url = 'http://cert.synxis.com/interface/ChannelConnect.asmx?WSDL' 155 start(url) 156 client = Client(url) 157 print client 158 #client.setport(0) 159 tpa = client.factory.create('ns1:TPA_Extensions') 160 print client.service.Ping(tpa, "hello") 161 except WebFault, f: 162 errors += 1 163 print f 164 print f.fault 165 except Exception, e: 166 errors += 1 167 print e 168 tb.print_exc() 169 170 try: 171 url = 'https://sec.neurofuzz-software.com/paos/genSSHA-SOAP.php?wsdl' 172 start(url) 173 client = Client(url) 174 print client 175 print client.service.genSSHA('hello', 'sha1') 176 except WebFault, f: 177 errors += 1 178 print f 179 print f.fault 180 except Exception, e: 181 errors += 1 182 print e 183 tb.print_exc() 184 185 try: 186 url = 'http://ap1314-dsr.compmed.ucdavis.edu/dataserver/Aperio.Images/Image?method=wsdl' 187 start(url) 188 client = Client(url) 189 #print client.factory.resolver.schema 190 print client 191 print 'Logon()' 192 reply = client.service.Logon('testuser','test') 193 print reply 194 except WebFault, f: 195 errors += 1 196 print f 197 print f.fault 198 except Exception, e: 199 errors += 1 200 print e 201 tb.print_exc() 202 203 try: 204 url = 'http://soa.ebrev.info/service.wsdl' 205 start(url) 206 client = Client(url) 207 print client 208 except WebFault, f: 209 errors += 1 210 print f 211 print f.fault 212 except Exception, e: 213 errors += 1 214 print e 215 tb.print_exc() 216 217 try: 218 url = 'http://arcweb.esri.com/services/v2/MapImage.wsdl' 219 start(url) 220 client = Client(url) 221 print client 222 env = client.factory.create('ns2:Envelope') 223 print env 224 options = client.factory.create('ns4:MapImageOptions') 225 print options 226 except WebFault, f: 227 errors += 1 228 print f 229 print f.fault 230 except Exception, e: 231 errors += 1 232 print e 233 tb.print_exc() 234 235 try: 236 url = "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl" 237 start(url) 238 client = Client(url) 239 print client 240 #client.setport(0) 241 print client.service.getBank("76251020") 242 except WebFault, f: 243 errors += 1 244 print f 245 print f.fault 246 except Exception, e: 247 errors += 1 248 print e 249 tb.print_exc() 250 251 try: 252 url = "http://arcweb.esri.com/services/v2/RouteFinder.wsdl" 253 start(url) 254 client = Client(url) 255 print client 256 except WebFault, f: 257 errors += 1 258 print f 259 print f.fault 260 except Exception, e: 261 errors += 1 262 print e 263 tb.print_exc() 264 265 timer = metrics.Timer() 266 267 try: 268 url = "https://www.e-conomic.com/secure/api1/EconomicWebService.asmx?WSDL" 269 start(url) 270 timer.start() 271 client = Client(url) 272 #client.setport(0) 273 timer.stop() 274 print 'create client: %s' % timer 275 timer.start() 276 s = str(client) 277 timer.stop() 278 print 'str(client): %s' % timer 279 print 'client:\n%s' % s 280 except WebFault, f: 281 errors += 1 282 print f 283 print f.fault 284 except Exception, e: 285 errors += 1 286 print e 287 tb.print_exc() 288 289 print '\nFinished: errors = %d' % errors 290