Created
March 12, 2011 19:06
-
-
Save james-prickett/867480 to your computer and use it in GitHub Desktop.
simple unit test for the security utils api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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