Ignore:
Timestamp:
29/09/09 15:42:02 (10 years ago)
Author:
pjkersha
Message:

Integrated automated start-up and shutdown of Paste http servers for unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg_security_test/ndg/security/test/unit/soap/test_soap.py

    r5527 r5779  
    1919from urllib2 import HTTPHandler, URLError 
    2020 
     21from ndg.security.test.unit import BaseTestCase 
    2122from ndg.security.common.soap.etree import SOAPEnvelope 
    2223from ndg.security.common.soap.client import UrlLib2SOAPClient, \ 
     
    2526class SOAPBindingMiddleware(object): 
    2627    """Simple WSGI interface for SOAP service""" 
    27      
     28         
    2829    def __call__(self, environ, start_response): 
    2930        requestFile = environ['wsgi.input'] 
     
    4243     
    4344     
    44 class SOAPTestCase(unittest.TestCase): 
    45     endpoint = 'http://localhost:10080/soap' 
     45class SOAPTestCase(BaseTestCase): 
     46    SOAP_SERVICE_PORTNUM = 10080 
     47    ENDPOINT = 'http://localhost:%d/soap' % SOAP_SERVICE_PORTNUM 
    4648     
    4749    def __init__(self, *args, **kwargs): 
     
    5052        self.app = paste.fixture.TestApp(wsgiApp) 
    5153          
    52         unittest.TestCase.__init__(self, *args, **kwargs) 
     54        super(SOAPTestCase, self).__init__(*args, **kwargs) 
    5355         
    5456    def test01Envelope(self): 
     
    8789         
    8890        # Paster based service must be running in separate script 
     91        self.addService(app=SOAPBindingMiddleware(),  
     92                        port=SOAPTestCase.SOAP_SERVICE_PORTNUM) 
     93         
    8994        client = UrlLib2SOAPClient() 
    9095         
     
    9398         
    9499        request = UrlLib2SOAPRequest() 
    95         request.url = SOAPTestCase.endpoint 
     100        request.url = SOAPTestCase.ENDPOINT 
    96101        request.envelope = SOAPEnvelope() 
    97102        request.envelope.create() 
Note: See TracChangeset for help on using the changeset viewer.