def jwt_manager_test(self): # Instance the manager to generate tokens that expires in 10 ms manager = JWTManager(self.secret, self.expire_time) # Encrypt a profile profile = {"hello": "world"} token = manager.get_token_for(profile) # Decrypt the profile decrypted_profile = manager.get_profile(token) self.assertEquals(profile, decrypted_profile) # Now wait 2 seconds and check if its valid now time.sleep(2) self.assertRaises(jwt.ExpiredSignature, manager.get_profile, token)