def test_get_key_hash_returns_appropriate_hash_value(self): user = User.put_from_city_dict(self.user_dict).get() user_jwt_decoded = decode_jwt(user.get_key_hash()) self.assertEqual(user.id, user_jwt_decoded['usr']['id'])
def test_decode_jwt_decodes_jwt_string_properly(self): jwt_token_string = create_jwt_from_dict(self.user_dict) decoded = decode_jwt(jwt_token_string) self.assertEqual(self.user_dict['id'], decoded['usr']['id'])
def test_decode_jwt_requires_jwt_string_parameter(self): with self.assertRaises(ValueError): decode_jwt(None)
def test_decode_jwt_allows_unicode_string(self): try: decode_jwt(u'myunicodestring') except TypeError: self.fail('should not get here')
def test_decode_jwt_requires_jwt_string_be_a_string(self): with self.assertRaises(TypeError): decode_jwt({'my': 'dict'})