Changeset 4738 for TI12-security


Ignore:
Timestamp:
05/01/09 13:23:21 (11 years ago)
Author:
pjkersha
Message:

Refactored WSGI SSL Client AuthN unit tests separating out test files into the config dir.

Location:
TI12-security/trunk/python/ndg.security.test/ndg/security/test
Files:
2 deleted
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sslclientauthnmiddleware/README

    r4609 r4738  
    11Test SSL Client Authentication WSGI Middleware.  The middleware can be run 
    2 under apste instance - run  
     2under paste instance - run  
    33 
    44$ python sslclientauthnapp.py 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sslclientauthnmiddleware/sslClientAuthN.cfg

    r4680 r4738  
    1010# version 1.0 or later. 
    1111[DEFAULT] 
    12 url = https://localhost 
     12#url = https://localhost 
     13url = https://localhost:7000 
    1314 
    1415[test01CheckAccessSecuredURLSucceeds] 
    15 path = /ndgsecurity/secure1 
     16#path = /ndgsecurity/secure1 
     17path = /secure1 
    1618 
    1719[test02CheckAccessSecuredURLFails] 
    18 path = /ndgsecurity/secure1 
     20#path = /ndgsecurity/secure1 
     21path = /secure1 
    1922 
    2023[test03CheckAccessNonSecuredURLSucceeds] 
    21 path = /ndgsecurity 
     24#path = /ndgsecurity 
     25path = / 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sslclientauthnmiddleware/sslclientauthnapp.py

    r4609 r4738  
    22logging.basicConfig(level=logging.DEBUG) 
    33import os 
     4from os.path import dirname, abspath, join 
    45 
    56from ndg.security.server.wsgi.apploader import AppLoaderMiddleware 
     
    1718def app_factory(app_conf, **local_conf): 
    1819    return application 
     20 
     21from ndg.security.test import BaseTestCase 
     22 
     23# Initialize environment for unit tests 
     24if BaseTestCase.configDirEnvVarName not in os.environ: 
     25    os.environ[BaseTestCase.configDirEnvVarName] = \ 
     26                            join(dirname(abspath(dirname(__file__))), 'config') 
    1927 
    2028# Initialize environment for unit tests 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sslclientauthnmiddleware/test.ini

    r4609 r4738  
    2929errorResponseCode: 401 
    3030pathMatchList: /secure1 /secure2 
    31 caCertFilePathList: $NDGSEC_SSLCLNTAUTHN_UNITTEST_DIR/ndg-test-ca.crt 
     31caCertFilePathList: $NDGSEC_UNITTEST_CONFIG_DIR/ca/ndg-test-ca.crt 
    3232 
    3333# Logging configuration 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sslclientauthnmiddleware/test_sslclientauthn.py

    r4680 r4738  
    1212__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    1313__revision__ = '$Id$' 
     14import logging 
     15logging.basicConfig(level=logging.DEBUG) 
    1416 
    1517import unittest 
     
    1921from os.path import expandvars as xpdVars 
    2022from os.path import join as jnPath 
    21 mkPath = lambda file: jnPath(os.environ['NDGSEC_SSLCLNTAUTHN_UNITTEST_DIR'],file) 
     23mkPath = lambda file: jnPath(os.environ['NDGSEC_SSLCLNTAUTHN_UNITTEST_DIR'], 
     24                             file) 
    2225 
    23 import logging 
    24 logging.basicConfig(level=logging.DEBUG) 
    25  
     26from ndg.security.test import BaseTestCase 
    2627from ndg.security.common.utils.configfileparsers import \ 
    2728                                                    CaseSensitiveConfigParser 
     
    2930 
    3031 
    31 class SSLClientAuthNMiddlewareTestCase(unittest.TestCase): 
     32class SSLClientAuthNMiddlewareTestCase(BaseTestCase): 
    3233    """Unit test case for  
    3334    ndg.security.server.wsgi.sslclientauthn.SSLClientAuthNMiddleware class. 
     
    3536     
    3637    def setUp(self): 
     38        super(SSLClientAuthNMiddlewareTestCase, self).setUp() 
    3739         
    3840        if 'NDGSEC_INT_DEBUG' in os.environ: 
     
    5355    def test01CheckAccessSecuredURLSucceeds(self): 
    5456        thisSection = 'test01CheckAccessSecuredURLSucceeds' 
     57         
     58        clntCertFilePath = xpdVars(os.path.join('$NDGSEC_UNITTEST_CONFIG_DIR', 
     59                                                'pki',  
     60                                                'test.crt')) 
     61        clntPriKeyFilePath=xpdVars(os.path.join('$NDGSEC_UNITTEST_CONFIG_DIR', 
     62                                                'pki',  
     63                                                'test.key')) 
    5564        con = HTTPSConnection(self.hostname,  
    56                               clntCertFilePath=mkPath('test.crt'), 
    57                               clntPriKeyFilePath=mkPath('test.key')) 
     65                              clntCertFilePath=clntCertFilePath, 
     66                              clntPriKeyFilePath=clntPriKeyFilePath) 
    5867        con.putrequest('GET', self.cfg.get(thisSection, 'path')) 
    5968        con.endheaders() 
Note: See TracChangeset for help on using the changeset viewer.