Commit a92b96ee authored by ale's avatar ale

Add some verifier tests with nonces

parent 01eb7558
......@@ -33,6 +33,20 @@ class VerifierTest(unittest.TestCase):
tkt2 = v.verify(signed)
self.assertEquals(tkt, tkt2)
def test_verify_ok_with_nonce(self):
tkt = sso.Ticket('user', 'service/', 'domain', nonce='nonce')
signed = self._sign_token(tkt)
v = sso.Verifier(self.public, 'service/', 'domain')
tkt2 = v.verify(signed, 'nonce')
self.assertEquals(tkt, tkt2)
self.assertEquals('user', tkt2.user())
def test_verify_fail_with_bad_nonce(self):
tkt = sso.Ticket('user', 'service/', 'domain', nonce='nonce')
signed = self._sign_token(tkt)
v = sso.Verifier(self.public, 'service/', 'domain')
self.assertRaises(sso.Error, v.verify, signed, 'bad_nonce')
def test_verify_fail_too_short(self):
signed = base64.b64encode('some data')
v = sso.Verifier(self.public, 'service/', 'domain', self.groups)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment