Ignore:
Timestamp:
27/11/08 12:18:11 (11 years ago)
Author:
pjkersha
Message:

New ndg.security.server.wsgi.utils package to hold Session Manager and Attribute Authority client wrappers. These check environ for a local SM/AA instance or call a remote service if a URI is given.

  • Added a test for Combined Services unit test to try out a Session Manager connect using the new wrapper.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/combinedservices/serverapp.py

    r4479 r4501  
    1414__revision__ = "$Id$" 
    1515import os 
     16from ndg.security.server.wsgi.utils.sessionmanagerclient import \ 
     17    WSGISessionManagerClient 
     18     
     19class InfoApp(object): 
     20    method = { 
     21        "/": 'default', 
     22        "/test_connect": "test_connect" 
     23    } 
     24     
     25    def __call__(self, environ, start_response): 
     26         
     27        methodName = self.method.get(environ['PATH_INFO'], '').rstrip() 
     28        if methodName: 
     29            action = getattr(self, methodName) 
     30            return action(environ, start_response) 
     31        else: 
     32            start_response('404 Not Found', [('Content-type', 'text/plain')]) 
     33            return "NDG Security Combined Services Unit tests: invalid URI" 
     34             
     35    def default(self, environ, start_response): 
     36        start_response('200 OK', [('Content-type', 'text/plain')]) 
     37        return "NDG Security Combined Services Unit Tests" 
    1638 
    17 def infoApp(environ, start_response): 
    18     start_response('200 OK', [('Content-type', 'text/plain')]) 
    19     return "NDG Security Services Unit Tests" 
    20  
     39    def test_connect(self, environ, start_response): 
     40         
     41        client = WSGISessionManagerClient(environ=environ) 
     42        res = client.connect("testuser", passphrase="testpassword") 
     43        start_response('200 OK', [('Content-type', 'text/plain')]) 
     44        return "test_connect succeeded" 
     45         
    2146def app_factory(global_config, **local_conf): 
    22     return infoApp 
     47    return InfoApp() 
    2348 
    2449 
Note: See TracChangeset for help on using the changeset viewer.