Index: /main/waeup.cas/trunk/waeup/cas/tests/test_server.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/tests/test_server.py	(revision 10400)
+++ /main/waeup.cas/trunk/waeup/cas/tests/test_server.py	(revision 10401)
@@ -112,4 +112,18 @@
         assert resp.content_type == 'text/html'
         assert b'<form ' in resp.body
+
+    def test_login_cred_acceptor_sso_no_service(self):
+        # 2.2.4: successful login via single sign on
+        app = CASServer()
+        tgc = create_tgc_value()
+        app.db.add(tgc)
+        value = str(tgc.value)
+        req = Request.blank('https://localhost/login')
+        req.headers['Cookie'] = 'cas-tgc=%s' % value
+        resp = app(req)
+        assert resp.status == '200 OK'
+        assert b'already' in resp.body
+        assert 'Set-Cookie' not in resp.headers
+        return
 
 
@@ -184,16 +198,4 @@
         assert b'ticket=ST-' in resp.body
 
-    def test_login_cred_acceptor_sso_no_service(self):
-        # 2.2.4: successful login via single sign on
-        db = self.raw_app.db
-        tgc = create_tgc_value()
-        db.add(tgc)
-        value = str(tgc.value)
-        resp = self.app.get('/login', headers={'Cookie': 'cas-tgc=%s' % value})
-        assert resp.status == '200 OK'
-        assert b'already' in resp.body
-        assert 'Set-Cookie' not in resp.headers
-        return
-
     def test_login_cred_acceptor_failed(self):
         # 2.2.4: failed login yields a message
@@ -205,4 +207,20 @@
         assert resp.status == '200 OK'
         assert b'failed' in resp.body
+
+    def test_login_sso_no_service(self):
+        # we can initiate single-sign-on without service
+        resp1 = self.app.get('https://localhost/login')  # HTTPS required!
+        assert resp1.status == '200 OK'
+        assert 'cas-tgc' not in self.app.cookies
+        form = resp1.forms[0]
+        form.set('username', 'bird')
+        form.set('password', 'bebop')
+        resp2 = form.submit('AUTHENTICATE')
+        assert resp2.status == '200 OK'
+        # we got a secure cookie
+        assert 'cas-tgc' in self.app.cookies
+        # when we get the login page again, the cookie will replace creds.
+        resp3 = self.app.get('https://localhost/login')
+        assert b'You logged in already' in resp3.body
 
 
