Ignore:
Timestamp:
4 Jul 2013, 22:08:53 (11 years ago)
Author:
uli
Message:

Enable session cookies for single sign on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/tests/test_server.py

    r10397 r10398  
    1212    CASServer, create_service_ticket, create_login_ticket,
    1313    create_tgc_value, check_login_ticket, set_session_cookie,
     14    check_session_cookie,
    1415    )
    15 
    1616
    1717RE_ALPHABET = re.compile('^[a-zA-Z0-9\-]*$')
     
    184184        assert b'ticket=ST-' in resp.body
    185185
     186    def test_login_cred_acceptor_sso_no_service(self):
     187        # 2.2.4: successful login via single sign on
     188        db = self.raw_app.db
     189        tgc = create_tgc_value()
     190        db.add(tgc)
     191        value = str(tgc.value)
     192        resp = self.app.get('/login', headers={'Cookie': 'cas-tgc=%s' % value})
     193        assert resp.status == '200 OK'
     194        assert b'already' in resp.body
     195        assert 'Set-Cookie' not in resp.headers
     196        return
     197
    186198    def test_login_cred_acceptor_failed(self):
    187199        # 2.2.4: failed login yields a message
     
    269281            TicketGrantingCookie.value == value)
    270282        assert len(list(q)) == 1
     283
     284    def test_check_session_cookie(self):
     285        db = DB('sqlite:///')
     286        tgc = create_tgc_value()
     287        db.add(tgc)
     288        value = tgc.value
     289        assert check_session_cookie(db, value) == tgc
     290        assert check_session_cookie(db, 'foo') is None
     291        assert check_session_cookie(db, b'foo') is None
     292        value2 = value.encode('utf-8')
     293        assert check_session_cookie(db, value2) == tgc
Note: See TracChangeset for help on using the changeset viewer.