source: TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/attributeauthorityclient/__init__.py @ 6571

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/attributeauthorityclient/__init__.py@6571
Revision 6571, 1.7 KB checked in by pjkersha, 10 years ago (diff)

Refactored SAML SOAP Binding unit test class into a separate module test_samlattributeauthorityclient

  • Property svn:keywords set to Id
Line 
1"""Attribute Authority SOAP client unit test package
2
3NERC Data Grid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "23/11/06"
7__copyright__ = "(C) 2009 Science and Technology Facilities Council"
8__license__ = "BSD - see LICENSE file in top-level directory"
9__contact__ = "Philip.Kershaw@stfc.ac.uk"
10__revision__ = '$Id$'
11from os import path, environ
12
13from ndg.security.test.unit import BaseTestCase, mkDataDirPath
14from ndg.security.common.X509 import X509Cert
15from ndg.security.common.utils.configfileparsers import (
16    CaseSensitiveConfigParser)
17
18
19class AttributeAuthorityClientBaseTestCase(BaseTestCase):
20    """Base class for NDG and SAML Attribute Authority client interfaces"""
21    CONFIG_FILENAME = 'attAuthorityClientTest.cfg'
22   
23    def __init__(self, *arg, **kw):
24        super(AttributeAuthorityClientBaseTestCase, self).__init__(*arg, **kw)
25
26        if 'NDGSEC_AACLNT_UNITTEST_DIR' not in environ:
27            environ['NDGSEC_AACLNT_UNITTEST_DIR'
28                                        ] = path.abspath(path.dirname(__file__))
29
30        self.cfgParser = CaseSensitiveConfigParser()
31        self.cfgFilePath = path.join(environ['NDGSEC_AACLNT_UNITTEST_DIR'],
32                                     self.__class__.CONFIG_FILENAME)
33        self.cfgParser.read(self.cfgFilePath)
34       
35        self.cfg = {}
36        for section in self.cfgParser.sections():
37            self.cfg[section] = dict(self.cfgParser.items(section))
38
39        try:
40            self.sslCACertList = [X509Cert.Read(xpdVars(caFile)) 
41                                  for caFile in self.cfg['setUp'][
42                                            'sslcaCertFilePathList'].split()]
43        except KeyError:
44            self.sslCACertList = []
45           
46        self.startAttributeAuthorities()       
Note: See TracBrowser for help on using the repository browser.