def test_using_existing_expiration_in_nonce(self): datestr = '2016-12-03T15:12:15Z' exp = utils.to_timestamp(datestr) self.raw_claims.update({'exp': exp}) claims = jose.normalize_claims(self.raw_claims) self.assertIn('jti', claims) self.assertEqual(claims['jti'][3:-6], datestr)
def test_using_v001_nonce(self): datestr = '2016-12-03T10:12:15Z' exp = utils.to_timestamp(datestr) nonce = '001' + datestr + 'ABC123' self.raw_claims.update({'jti': nonce}) claims = jose.normalize_claims(self.raw_claims) self.assertIn('exp', claims) self.assertNotEqual(claims['exp'], exp)
def test_sunny_day(self): claims = jose.normalize_claims(self.raw_claims) self.assertIsInstance(claims, dict) for k in self.claim_keys + ['jti', 'nbf', 'exp']: self.assertIn(k, claims) self.assertNotIn('iss', claims) self.assertEqual(utils.to_timestamp(claims['jti'][3:-6]), claims['exp']) self.assertGreater(claims['exp'], claims['nbf'])
def test_to_timestamp(self): self.assertEqual(utils.to_timestamp(self.dt), self.ts) self.assertEqual(utils.to_timestamp(self.iso_dt), self.ts)