source: main/waeup.cas/trunk/waeup/cas/tests/test_server.py @ 10326

Last change on this file since 10326 was 10326, checked in by uli, 11 years ago

Check for default pages required by CAS protocol.

File size: 1.7 KB
Line 
1import os
2import shutil
3import tempfile
4import unittest
5from paste.deploy import loadapp
6from webob import Request
7from waeup.cas.server import CASServer
8
9
10class CASServerTests(unittest.TestCase):
11
12    def setUp(self):
13        self.workdir = tempfile.mkdtemp()
14        self.paste_conf1 = os.path.join(
15            os.path.dirname(__file__), 'sample1.ini')
16
17    def tearDown(self):
18        shutil.rmtree(self.workdir)
19
20    def test_paste_deploy_loader(self):
21        # we can load the CAS server via paste.deploy plugin
22        app = loadapp('config:%s' % self.paste_conf1)
23        assert isinstance(app, CASServer)
24
25    def test_paste_deploy_options(self):
26        # we can set CAS server-related options via paste.deploy config
27        app = loadapp('config:%s' % self.paste_conf1)
28        assert isinstance(app, CASServer)
29
30    def test_call_root(self):
31        # the CAS protocol requires no root
32        app = CASServer()
33        req = Request.blank('http://localhost/')
34        resp = app(req)
35        assert resp.status == '404 Not Found'
36
37    def test_first_time_login(self):
38        # we can get a login page
39        app = CASServer()
40        req = Request.blank('http://localhost/login')
41        resp = app(req)
42        assert resp.status == '200 OK'
43
44    def test_validate(self):
45        # we can access a validation page
46        app = CASServer()
47        req = Request.blank('http://localhost/validate')
48        resp = app(req)
49        assert resp.status == '501 Not Implemented'
50
51    def test_logout(self):
52        # we can access a logout page
53        app = CASServer()
54        req = Request.blank('http://localhost/logout')
55        resp = app(req)
56        assert resp.status == '501 Not Implemented'
Note: See TracBrowser for help on using the repository browser.