source: TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/config/attributeauthority/sitea/sitea_attributeauthority.py @ 6720

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg-security/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/config/attributeauthority/sitea/sitea_attributeauthority.py@6720
Revision 6720, 1.6 KB checked in by pjkersha, 11 years ago (diff)
  • Attribute Authority unit tests now pass with refactored Attribute Authority which has NDG Attribute Certificate and role mapping code removed.
  • Now refactoring client unit tests.
  • Removed NDG Attribute Certificate and XMLSec unit tests - no longer needed.
  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2"""NDG Security Attribute Authority test harness for unit test site 'A'
3
4NERC Data Grid Project
5
6"""
7__author__ = "P J Kershaw"
8__date__ = "24/09/08"
9__copyright__ = "(C) 2009 Science and Technology Facilities Council"
10__contact__ = "Philip.Kershaw@stfc.ac.uk"
11__revision__ = "$Id: $"
12import os
13from os.path import dirname, abspath, join
14
15def infoApp(environ, start_response):
16    response = "NDG Security Attribute Authority Unit Tests: Site A Server"
17    start_response('200 OK', [('Content-type', 'text/plain'),
18                              ('Content-length', str(len(response)))])
19    return [response]
20
21def app_factory(global_config, **local_conf):
22    return infoApp
23
24from ndg.security.test.unit import BaseTestCase
25
26# Initialize environment for unit tests
27if BaseTestCase.configDirEnvVarName not in os.environ:
28    os.environ[BaseTestCase.configDirEnvVarName] = \
29                                dirname(dirname(abspath(dirname(__file__))))
30
31# To start the Site A Attribute Authority run
32# $ paster serve site-a.ini or run this file as a script
33# $ ./siteAServerApp.py [port #]
34if __name__ == '__main__':
35    import sys
36    import logging
37#    logging.basicConfig(level=logging.DEBUG)
38
39    if len(sys.argv) > 1:
40        port = int(sys.argv[1])
41    else:
42        port = 5000
43       
44    cfgFilePath = join(dirname(abspath(__file__)), 'site-a.ini')
45       
46    from paste.httpserver import serve
47    from paste.deploy import loadapp
48    from paste.script.util.logging_config import fileConfig
49   
50    fileConfig(cfgFilePath)
51    app = loadapp('config:%s' % cfgFilePath)
52    serve(app, host='0.0.0.0', port=port)
Note: See TracBrowser for help on using the repository browser.