source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/attAuthority/wsgi/siteAServerApp.py @ 4194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/attAuthority/wsgi/siteAServerApp.py@4194
Revision 4194, 1.7 KB checked in by pjkersha, 12 years ago (diff)

Added PasteDeploy? test harness for Attribute Authority middleware unit tests

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2import os
3
4from pylons import config
5
6def makeApp(global_conf, app_conf):
7    """Configure the Pylons environment via the ``pylons.config``
8    object
9    """
10    # Pylons paths
11    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
12    paths = dict(root=root)
13
14    # Initialize config with the basic options
15    config.init_app(global_conf, app_conf)
16   
17    return app()
18
19def helloApp(environ, start_response):
20    start_response('200 OK', [('Content-type', 'text/plain')])
21    return "Hello"
22
23def app_factory(global_config, **local_conf):
24    return helloApp
25
26from paste.deploy import loadapp
27cfgFilePath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
28                           'site-a.ini')
29if 'NDGSEC_AACLNT_UNITTEST_DIR' not in os.environ:
30    os.environ['NDGSEC_AACLNT_UNITTEST_DIR'] = \
31                    os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
32   
33if 'NDGSEC_AA_PROPFILEPATH' not in os.environ:
34    os.environ['NDGSEC_AA_PROPFILEPATH'] = \
35                        os.path.join(os.environ['NDGSEC_AACLNT_UNITTEST_DIR'],
36#                                     "siteAAttAuthority.cfg")
37                                     "siteAAttAuthorityProperties.xml")
38   
39if 'NDGSEC_DIR' in os.environ:
40    tacFilePath=os.path.join(os.environ['NDGSEC_DIR'],
41                             "conf",
42                             "attAuthority.tac")
43else:
44    import pkg_resources
45    eggConfigDir=pkg_resources.resource_filename('ndg.security.server','conf')
46    os.environ['NDGSEC_DIR'] = os.path.dirname(eggConfigDir)
47
48def wsgiApp():
49    return loadapp('config:%s' % cfgFilePath)
50
51if __name__ == '__main__':
52    from paste.httpserver import serve
53    app = wsgiApp()
54    serve(app)#, host='0.0.0.0', port=8082)
Note: See TracBrowser for help on using the repository browser.