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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/config/attributeauthority/sitea/sitea_attributeauthority.py@7829
Revision 7829, 1.8 KB checked in by pjkersha, 10 years ago (diff)

Incomplete - task 16: NDG Security 2.x.x - incl. updated Paster templates

  • Completed Attribute Service template and tested standalone
  • Property svn:executable set to *
  • Property svn:keywords set to Id
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
14import optparse
15from ndg.security.test.unit.wsgi import PasteDeployAppServer
16
17INI_FILENAME = 'site-a.ini'
18
19
20from ndg.security.test.unit import BaseTestCase
21
22# Initialize environment for unit tests
23if BaseTestCase.configDirEnvVarName not in os.environ:
24    os.environ[BaseTestCase.configDirEnvVarName] = \
25                                dirname(dirname(abspath(dirname(__file__))))
26
27# To start the Site A Attribute Authority run
28# $ paster serve site-a.ini or run this file as a script
29# $ ./sitea_attributeauthority.py [--port #][--conf <config file path>]
30if __name__ == '__main__':
31    import sys
32    import logging
33       
34    cfgFilePath = os.path.join(dirname(abspath(__file__)), INI_FILENAME) 
35       
36    parser = optparse.OptionParser()
37    parser.add_option("-p",
38                      "--port",
39                      dest="port",
40                      default=5000,
41                      type='int',
42                      help="port number to run under")
43
44    parser.add_option("-c",
45                      "--conf",
46                      dest="configFilePath",
47                      default=cfgFilePath,
48                      help="Configuration file path")
49   
50    # Initialise test user database
51    from ndg.security.test.unit import BaseTestCase
52    BaseTestCase.initDb()
53   
54    opt = parser.parse_args()[0]       
55    server = PasteDeployAppServer(cfgFilePath=opt.configFilePath, 
56                                  port=opt.port) 
57    server.start()
Note: See TracBrowser for help on using the repository browser.