source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/config/attributeauthority/sitea/siteAServerApp.py @ 5290

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/config/attributeauthority/sitea/siteAServerApp.py@5290
Revision 5290, 1.4 KB checked in by pjkersha, 11 years ago (diff)

Reworking unit tests

  • 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    start_response('200 OK', [('Content-type', 'text/plain')])
17    return "NDG Security Attribute Authority Unit Tests: Site A Server"
18
19def app_factory(global_config, **local_conf):
20    return infoApp
21
22from ndg.security.test.unit import BaseTestCase
23
24# Initialize environment for unit tests
25if BaseTestCase.configDirEnvVarName not in os.environ:
26    os.environ[BaseTestCase.configDirEnvVarName] = \
27                                dirname(dirname(abspath(dirname(__file__))))
28
29# To start the Site A Attribute Authority run
30# $ paster serve site-a.ini or run this file as a script
31# $ ./siteAServerApp.py [port #]
32if __name__ == '__main__':
33    import sys
34    import logging
35    logging.basicConfig(level=logging.DEBUG)
36
37    if len(sys.argv) > 1:
38        port = int(sys.argv[1])
39    else:
40        port = 5000
41       
42    cfgFilePath = join(dirname(abspath(__file__)), 'site-a.ini')
43       
44    from paste.httpserver import serve
45    from paste.deploy import loadapp
46
47    app = loadapp('config:%s' % cfgFilePath)
48    serve(app, host='0.0.0.0', port=port)
Note: See TracBrowser for help on using the repository browser.