test_Racing.py :  » Web-Services » ZSI » ZSI-2.0 » test » wsdl2py » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Web Services » ZSI 
ZSI » ZSI 2.0 » test » wsdl2py » test_Racing.py
#!/usr/bin/env python
############################################################################
# Joshua R. Boverhof, LBNL
# See LBNLCopyright for copyright notice!
###########################################################################
import os, sys, unittest
from ServiceTest import main,ServiceTestCase,ServiceTestSuite
from ZSI import FaultException,ParsedSoap
"""
Unittest 

WSDL:   
"""

# General targets
def dispatch():
    """Run all dispatch tests"""
    suite = ServiceTestSuite()
    suite.addTest(unittest.makeSuite(TestCase, 'test_dispatch'))
    return suite

def local():
    """Run all local tests"""
    suite = ServiceTestSuite()
    suite.addTest(unittest.makeSuite(TestCase, 'test_local'))
    return suite

def net():
    """Run all network tests"""
    suite = ServiceTestSuite()
    suite.addTest(unittest.makeSuite(TestCase, 'test_net'))
    return suite
    
def all():
    """Run all tests"""
    suite = ServiceTestSuite()
    suite.addTest(unittest.makeSuite(TestCase, 'test_'))
    return suite


class TestCase(ServiceTestCase):
    name = "test_Racing"
    client_file_name = "Racing_services.py"
    types_file_name  = "Racing_services_types.py"
    server_file_name = "Racing_services_server.py"

    def __init__(self, methodName):
        ServiceTestCase.__init__(self, methodName)
        self.wsdl2py_args.append('-b')

    def test_local_anyType(self):
        """rpc/lit, testing if <any/> lax content handling
        should get back dicts and strings 
        """
        ps = ParsedSoap(MSG)
        pyobj = ps.Parse(self.client_module.EventApproximatesSoapOut.typecode)

        any = {'PoolTotals': {'Pool': {'Total': u'4117.66', 'ENumbers': None, 'JackpotNet': None}}, 'Approximates': {'Pool': {'Win': u'3.90,0.00,10.40,11.80,4.70,29.50,29.90,2.40,19.80,0.00', 'Place': u'1.04,0.00,2.80,5.90,2.00,5.20,7.40,1.04,4.00,0.00'}}}

        self.failUnless(pyobj.EventApproximatesResult.Any == any, 'Failed match:\n %s\n\n%s' %(
            pyobj.EventApproximatesResult.Any, any))


MSG="""<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <EventApproximatesResponse xmlns="http://direct.tab.com.au/LiveOdds/">
      <EventApproximatesResult>
        <Information xmlns="" Jurisdiction="NSW">
          <Approximates RID="SG_20070123_05" Timestamp="20:17:17 20070123">
            <Pool>
              <Win>3.90,0.00,10.40,11.80,4.70,29.50,29.90,2.40,19.80,0.00</Win>
              <Place status="">1.04,0.00,2.80,5.90,2.00,5.20,7.40,1.04,4.00,0.00</Place>
            </Pool>
          </Approximates>
          <PoolTotals RID="SG_20070123_05">
            <Pool BetTypeDesc="Exacta">
              <Total>451.00</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="First Four">
              <Total>1001.00</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Place">
              <Total>1750.59</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Quaddie">
              <Total>6052.50</Total>
              <ENumbers>05 06 07 08</ENumbers>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Quinella">
              <Total>865.00</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Running Double">
              <Total>21.50</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Trifecta">
              <Total>2575.50</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
            <Pool BetTypeDesc="Win">
              <Total>4117.66</Total>
              <ENumbers/>
              <JackpotNet/>
            </Pool>
          </PoolTotals>
        </Information>
      </EventApproximatesResult>
    </EventApproximatesResponse>
  </soap:Body>
</soap:Envelope>"""


if __name__ == "__main__" :
    main()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.