Changeset 10335 for main/waeup.cas/trunk/waeup/cas
- Timestamp:
- 21 Jun 2013, 23:39:57 (12 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/server.py
r10327 r10335 1 1 """A WSGI app for serving CAS. 2 2 """ 3 import os 3 4 from webob import exc, Response 4 5 from webob.dec import wsgify 6 7 template_dir = os.path.join(os.path.dirname(__file__), 'templates') 5 8 6 9 … … 10 13 @wsgify 11 14 def __call__(self, req): 12 if req.path _qsin ['/login', '/validate', '/logout']:13 return getattr(self, req.path _qs[1:])(req)15 if req.path in ['/login', '/validate', '/logout']: 16 return getattr(self, req.path[1:])(req) 14 17 return exc.HTTPNotFound() 15 18 16 19 def login(self, req): 20 return Response( 21 open(os.path.join(template_dir, 'login.html'), 'r').read()) 17 22 return Response('Hi there!') 18 23 -
main/waeup.cas/trunk/waeup/cas/tests/test_server.py
r10326 r10335 55 55 resp = app(req) 56 56 assert resp.status == '501 Not Implemented' 57 58 def test_login_simple(self): 59 # a simple login with no service will result in login screen 60 # (2.1.1#service of protocol specs) 61 app = CASServer() 62 req = Request.blank('http://localhost/login') 63 resp = app(req) 64 assert resp.status == '200 OK' 65 assert resp.content_type == 'text/html' 66 assert b'<form ' in resp.body
Note: See TracChangeset for help on using the changeset viewer.