1 | """Attribute Authority SOAP client unit test package |
---|
2 | |
---|
3 | NERC 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$' |
---|
11 | from os import path, environ |
---|
12 | |
---|
13 | from ndg.security.test.unit import BaseTestCase, mkDataDirPath |
---|
14 | from ndg.security.common.X509 import X509Cert |
---|
15 | from ndg.security.common.utils.configfileparsers import ( |
---|
16 | CaseSensitiveConfigParser) |
---|
17 | |
---|
18 | |
---|
19 | class 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 | |
---|