You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
1.8 KiB

  1. #!/usr/bin/env python
  2. ############################################################################
  3. # Joshua R. Boverhof, David W. Robertson, LBNL
  4. # See LBNLCopyright for copyright notice!
  5. ###########################################################################
  6. import unittest, sys, copy
  7. from ConfigParser import NoOptionError
  8. import utils
  9. from ZSI.wstools.WSDLTools import WSDLReader
  10. """
  11. Unittest for the wstools WSDLReader class
  12. """
  13. class WSDLReaderTestCase(unittest.TestCase):
  14. def __init__(self, methodName='runTest'):
  15. global configLoader
  16. unittest.TestCase.__init__(self, methodName)
  17. def setUp(self):
  18. # not thread safe
  19. self.path = configLoader.nameGenerator.next()
  20. print self.path
  21. sys.stdout.flush()
  22. def __str__(self):
  23. teststr = unittest.TestCase.__str__(self)
  24. if hasattr(self, "path"):
  25. self.printedOut = True
  26. return "%s: %s" % (teststr, self.path )
  27. else:
  28. return "%s" % (teststr)
  29. def test_WSDLReader(self):
  30. if self.path[:7] == 'http://':
  31. wsdl = WSDLReader().loadFromURL(self.path)
  32. else:
  33. wsdl = WSDLReader().loadFromFile(self.path)
  34. def makeTestSuite(section=None):
  35. global configLoader
  36. suite = unittest.TestSuite()
  37. configLoader = utils.MatchTestLoader(False, "config.py", "WSDLReaderTestCase")
  38. if not section:
  39. found = configLoader.setSection(sys.argv)
  40. if not found:
  41. configLoader.setSection("services_by_http")
  42. else:
  43. configLoader.setSection(section)
  44. suite.addTest(configLoader.loadTestsFromConfig(WSDLReaderTestCase))
  45. return suite
  46. def main():
  47. loader = utils.MatchTestLoader(False, None, "makeTestSuite")
  48. unittest.main(defaultTest="makeTestSuite", testLoader=loader)
  49. if __name__ == "__main__" : main()