Changeset 6892


Ignore:
Timestamp:
26/05/10 12:41:36 (9 years ago)
Author:
pjkersha
Message:

Added MyProxy? logon client shell script - uses a combination of openssl and wget to invoke the MyProxy? web service.

Location:
TI12-security/trunk/MyProxyServerUtils/myproxy/server/test
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/MyProxyServerUtils/myproxy/server/test/__init__.py

    r6881 r6892  
     1"""MyProxy Server Utilities unit test package 
     2""" 
     3__author__ = "P J Kershaw" 
     4__date__ = "25/05/10" 
     5__copyright__ = "(C) 2010 Science and Technology Facilities Council" 
     6__license__ = "BSD - see LICENSE file in top-level directory" 
     7__contact__ = "Philip.Kershaw@stfc.ac.uk" 
     8__revision__ = '$Id$' 
     9import logging 
     10logging.basicConfig(level=logging.DEBUG) 
     11 
     12import paste.httpserver 
     13from threading import Thread 
     14from paste.deploy import loadapp 
     15from paste.script.util.logging_config import fileConfig 
     16 
     17 
     18class PasteDeployAppServer(object): 
     19    """Wrapper to paste.httpserver to enable background threading""" 
     20     
     21    def __init__(self, app=None, cfgFilePath=None, port=7443, host='0.0.0.0', 
     22                 ssl_context=None): 
     23        """Load an application configuration from cfgFilePath ini file and  
     24        instantiate Paste server object 
     25        """        
     26        self.__thread = None 
     27         
     28        if cfgFilePath: 
     29            fileConfig(cfgFilePath) 
     30            app = loadapp('config:%s' % cfgFilePath) 
     31             
     32        elif app is None: 
     33            raise KeyError('Either the "cfgFilePath" or "app" keyword must be ' 
     34                           'set') 
     35                        
     36        self.__pasteServer = paste.httpserver.serve(app, host=host, port=port,  
     37                                                    start_loop=False,  
     38                                                    ssl_context=ssl_context) 
     39     
     40    @property 
     41    def pasteServer(self): 
     42        return self.__pasteServer 
     43     
     44    @property 
     45    def thread(self): 
     46        return self.__thread 
     47     
     48    def start(self): 
     49        """Start server""" 
     50        self.pasteServer.serve_forever() 
     51         
     52    def startThread(self): 
     53        """Start server in a separate thread""" 
     54        self.__thread = Thread(target=PasteDeployAppServer.start, args=(self,)) 
     55        self.thread.start() 
     56         
     57    def terminateThread(self): 
     58        self.pasteServer.server_close() 
  • TI12-security/trunk/MyProxyServerUtils/myproxy/server/test/test_myproxywsgi.py

    r6888 r6892  
    77__license__ = "BSD - see LICENSE file in top-level directory" 
    88__contact__ = "Philip.Kershaw@stfc.ac.uk" 
    9 __revision__ = '$Id: $' 
     9__revision__ = '$Id$' 
    1010import logging 
    1111logging.basicConfig(level=logging.DEBUG) 
Note: See TracChangeset for help on using the changeset viewer.