Skip to content

Instantly share code, notes, and snippets.

@james-prickett
Created March 12, 2011 19:06
Show Gist options
  • Select an option

  • Save james-prickett/867480 to your computer and use it in GitHub Desktop.

Select an option

Save james-prickett/867480 to your computer and use it in GitHub Desktop.
simple unit test for the security utils api
import unittest
from utils.security_utils import SecurityUtils
class TestUtils(unittest.TestCase):
def test_security_encode_user_id(self):
id = 154
key = SecurityUtils.encode_user_id(id)
self.assertNotEquals(None, key)
self.assertEquals('wdDpFaB8KNjQ6bWnw%2F%2FOi7R%2F5dDkd04wCGMMVxtjPC4%3D', key)
decoded_id = SecurityUtils.decode_user_id(key)
self.assertNotEquals(None, decoded_id)
self.assertEquals(154, decoded_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment