Changeset 10409


Ignore:
Timestamp:
5 Jul 2013, 11:36:29 (11 years ago)
Author:
uli
Message:

Test and fix login behaviour in case we send service params.

Location:
main/waeup.cas/trunk/waeup/cas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/server.py

    r10408 r10409  
    149149    resp.expires = 'Thu, 01 Dec 1994 16:00:00 GMT'
    150150    resp.text = html
     151    if not sso:
     152        resp = set_session_cookie(db, resp)
    151153    return resp
    152154
  • main/waeup.cas/trunk/waeup/cas/tests/test_server.py

    r10405 r10409  
    224224        assert b'You logged in already' in resp3.body
    225225
     226    def test_login_sso_with_service(self):
     227        resp1 = self.app.get(
     228            'https://localhost/login?service=http://service.com/')
     229        assert resp1.status == '200 OK'
     230        assert 'cas-tgc' not in self.app.cookies
     231        form = resp1.forms[0]
     232        form.set('username', 'bird')
     233        form.set('password', 'bebop')
     234        resp2 = form.submit('AUTHENTICATE')
     235        assert resp2.status == '303 See Other'
     236        assert resp2.headers['Location'].startswith(
     237            'http://service.com/?ticket=ST-')
     238        # we got a secure cookie
     239        assert 'cas-tgc' in self.app.cookies
     240        resp3 = self.app.get(
     241            'https://localhost/login?service=http://service.com/')
     242        assert resp3.status == '303 See Other'
     243        assert resp3.headers['Location'].startswith(
     244            'http://service.com/?ticket=ST-')
     245
    226246
    227247class CASServerHelperTests(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.