• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

contrib/opal/ZSI/test/test_QName.py

00001 #!/usr/bin/env python
00002 import unittest, sys, tests_good, tests_bad, time
00003 from ZSI import *
00004 try:
00005     import cStringIO as StringIO
00006 except ImportError:
00007     import StringIO
00008 
00009 
00010 """Bug [ 1520092 ] URI Bug: urllib.quote escaping reserved chars
00011 """
00012 
00013 
00014 class TestCase(unittest.TestCase):
00015     def check_soapfault_faultcode(self):
00016         """ Typecode QName when default namespace is not declared, should
00017         specify the empty namespace.
00018         """ 
00019         msg = """<?xml version="1.0" encoding="UTF-8"?>
00020 <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
00021   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
00022   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
00023   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
00024 <soapenv:Body>
00025 <soapenv:Fault>
00026    <faultcode>ServerFaultCode</faultcode>
00027    <faultstring>Operation failed since VMware tools are not running in this virtual machine.</faultstring>
00028    <detail>
00029      <ToolsUnavailableFault xmlns="urn:vim2"/>
00030    </detail>
00031 </soapenv:Fault>
00032 </soapenv:Body>
00033 </soapenv:Envelope>"""
00034 
00035         from ZSI import ParsedSoap, FaultFromFaultMessage
00036         ps = ParsedSoap(msg)
00037         fault = FaultFromFaultMessage(ps)
00038         self.failUnless(fault.code == ('','ServerFaultCode'), 'faultcode should be (namespace,name) tuple')
00039 
00040 
00041 #
00042 # Creates permutation of test options: "check", "check_any", etc
00043 #
00044 _SEP = '_'
00045 for t in [i[0].split(_SEP) for i in filter(lambda i: callable(i[1]), TestCase.__dict__.items())]:
00046     test = ''
00047     for f in t:
00048         test += f
00049         if globals().has_key(test): test += _SEP; continue
00050         def _closure():
00051             name = test
00052             def _makeTestSuite():
00053                 suite = unittest.TestSuite()
00054                 suite.addTest(unittest.makeSuite(TestCase, name))
00055                 return suite
00056             return _makeTestSuite
00057 
00058         globals()[test] = _closure()
00059         test += _SEP
00060 
00061 
00062 makeTestSuite = check
00063 def main():
00064     unittest.main(defaultTest="makeTestSuite")
00065 if __name__ == "__main__" : main()
00066 
00067 

Generated on Wed Oct 20 2010 11:12:16 for APBS by  doxygen 1.7.2