Changeset 10401 for main/waeup.cas/trunk/waeup/cas
- Timestamp:
- 5 Jul 2013, 06:04:33 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/tests/test_server.py
r10398 r10401 112 112 assert resp.content_type == 'text/html' 113 113 assert b'<form ' in resp.body 114 115 def test_login_cred_acceptor_sso_no_service(self): 116 # 2.2.4: successful login via single sign on 117 app = CASServer() 118 tgc = create_tgc_value() 119 app.db.add(tgc) 120 value = str(tgc.value) 121 req = Request.blank('https://localhost/login') 122 req.headers['Cookie'] = 'cas-tgc=%s' % value 123 resp = app(req) 124 assert resp.status == '200 OK' 125 assert b'already' in resp.body 126 assert 'Set-Cookie' not in resp.headers 127 return 114 128 115 129 … … 184 198 assert b'ticket=ST-' in resp.body 185 199 186 def test_login_cred_acceptor_sso_no_service(self):187 # 2.2.4: successful login via single sign on188 db = self.raw_app.db189 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.body195 assert 'Set-Cookie' not in resp.headers196 return197 198 200 def test_login_cred_acceptor_failed(self): 199 201 # 2.2.4: failed login yields a message … … 205 207 assert resp.status == '200 OK' 206 208 assert b'failed' in resp.body 209 210 def test_login_sso_no_service(self): 211 # we can initiate single-sign-on without service 212 resp1 = self.app.get('https://localhost/login') # HTTPS required! 213 assert resp1.status == '200 OK' 214 assert 'cas-tgc' not in self.app.cookies 215 form = resp1.forms[0] 216 form.set('username', 'bird') 217 form.set('password', 'bebop') 218 resp2 = form.submit('AUTHENTICATE') 219 assert resp2.status == '200 OK' 220 # we got a secure cookie 221 assert 'cas-tgc' in self.app.cookies 222 # when we get the login page again, the cookie will replace creds. 223 resp3 = self.app.get('https://localhost/login') 224 assert b'You logged in already' in resp3.body 207 225 208 226
Note: See TracChangeset for help on using the changeset viewer.