summaryrefslogtreecommitdiff
path: root/passlib
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-06-02 17:36:05 -0400
committerEli Collins <elic@assurancetechnologies.com>2011-06-02 17:36:05 -0400
commit45151c2ceda481ff891f0fe35c500aebda7f1aea (patch)
tree0fa7b977ff5de4620e4988da24b6962341b03d39 /passlib
parent0b9e148d3605fca14138813f5f679e2c387d8966 (diff)
downloadpasslib-45151c2ceda481ff891f0fe35c500aebda7f1aea.tar.gz
misc cleanups
Diffstat (limited to 'passlib')
-rw-r--r--passlib/handlers/sha1_crypt.py1
-rw-r--r--passlib/tests/test_utils.py79
-rw-r--r--passlib/tests/utils.py2
-rw-r--r--passlib/utils/__init__.py2
4 files changed, 1 insertions, 83 deletions
diff --git a/passlib/handlers/sha1_crypt.py b/passlib/handlers/sha1_crypt.py
index 1ba7a4a..6ad4e02 100644
--- a/passlib/handlers/sha1_crypt.py
+++ b/passlib/handlers/sha1_crypt.py
@@ -41,7 +41,6 @@ class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler
:param rounds:
Optional number of rounds to use.
Defaults to 40000, must be between 1 and 4294967295, inclusive.
- This value is logarithmic, the actual number of iterations used will be :samp:`2**{rounds}`.
It will use the first available of two possible backends:
diff --git a/passlib/tests/test_utils.py b/passlib/tests/test_utils.py
index 1bf0736..319030b 100644
--- a/passlib/tests/test_utils.py
+++ b/passlib/tests/test_utils.py
@@ -34,85 +34,6 @@ class UtilsTest(TestCase):
self.assertTrue(Undef!=Undef,)
self.assertTrue(Undef!=True,)
- def test_list_to_bytes(self):
- with catch_warnings():
- warnings.filterwarnings("ignore", r"list_to_bytes\(\) is deprecated")
-
- self.assertFunctionResults(utils.list_to_bytes, [
- #standard big endian
- ak('\x00', [0], 1),
- ak('\x01', [1], 1),
- ak('\x00\x01', [1], 2),
- ak('\x00\x01', [0, 1], 2),
- ak('\x00\x00\x01', [1], 3),
- ak('\x00\x00\x00\x00', [0], 4),
- ak('\x00\x00\x00\x01', [1], 4),
- ak('\x00\x00\x00\xff', [255], 4),
- ak('\x00\x00\x01\xff', [1, 255], 4),
- ak('\x04\x03\x02\x01', [4, 3, 2, 1], 4),
-
- #standard little endian
- ak('\x00', [0], 1, order="little"),
- ak('\x01', [1], 1, order="little"),
- ak('\x01\x00', [1], 2, order="little"),
- ak('\x01\x00', [0, 1], 2, order="little"),
- ak('\x01\x00\x00', [1], 3, order="little"),
- ak('\x00\x00\x00\x00', [0], 4, order="little"),
- ak('\x01\x00\x00\x00', [1], 4, order="little"),
- ak('\xff\x00\x00\x00', [255], 4, order="little"),
- ak('\xff\x01\x00\x00', [1, 255], 4, order="little"),
- ak('\x01\x02\x03\x04', [4, 3, 2, 1], 4, order="little"),
-
- ])
-
- #check bytes size check
- self.assertRaises(ValueError, utils.list_to_bytes, [])
- self.assertRaises(ValueError, utils.list_to_bytes, [], count=0)
- self.assertRaises(ValueError, utils.list_to_bytes, [0, 0], count=1)
-
- #check bytes bound check
- self.assertRaises(ValueError, utils.list_to_bytes, [256], count=1)
-
- #quick check native mode works right
- if sys.byteorder == "little":
- self.assertEqual(utils.list_to_bytes([1], 3, order="native"), '\x01\x00\x00')
- else:
- self.assertEqual(utils.list_to_bytes([1], 3, order="native"), '\x00\x00\x01')
-
- def test_bytes_to_list(self):
- with catch_warnings():
- warnings.filterwarnings("ignore", r"bytes_to_list\(\) is deprecated")
-
- self.assertFunctionResults(utils.bytes_to_list, [
-
- #standard big endian
- ak([1], '\x01'),
- ak([0, 1], '\x00\x01'),
- ak([0, 0, 1], '\x00\x00\x01'),
- ak([0, 0, 0, 0],'\x00\x00\x00\x00'),
- ak([0, 0, 0, 1],'\x00\x00\x00\x01'),
- ak([0, 0, 0, 255],'\x00\x00\x00\xff'),
- ak([0, 0, 1, 0],'\x00\x00\x01\x00'),
- ak([4, 3, 2, 1],'\x04\x03\x02\x01'),
-
- #standard little endian
- ak([1], '\x01', order="little"),
- ak([0, 1], '\x01\x00', order="little"),
- ak([0, 0, 1], '\x01\x00\x00', order="little"),
- ak([0, 0, 0, 0], '\x00\x00\x00\x00', order="little"),
- ak([0, 0, 0, 1], '\x01\x00\x00\x00', order="little"),
- ak([0, 0, 0, 255], '\xff\x00\x00\x00', order="little"),
- ak([0, 0, 1, 0], '\x00\x01\x00\x00', order="little"),
- ak([4, 3, 2, 1],'\x01\x02\x03\x04', order="little"),
-
- ])
-
- #quick check native mode works right
- if sys.byteorder == "little":
- self.assertEqual(utils.bytes_to_list('\x01\x00\x00', order="native"), [0, 0, 1])
- else:
- self.assertEqual(utils.bytes_to_list('\x00\x00\x01', order="native"), [0, 0, 1])
-
def test_getrandbytes(self):
def f(*a,**k):
return utils.getrandbytes(utils.rng, *a, **k)
diff --git a/passlib/tests/utils.py b/passlib/tests/utils.py
index 20197c2..f77314f 100644
--- a/passlib/tests/utils.py
+++ b/passlib/tests/utils.py
@@ -588,7 +588,7 @@ class HandlerCase(TestCase):
self.assertNotEqual(c1,c3)
def test_33_genconfig_saltcharset(self):
- "test genconfig() honors salt charset"
+ "test genconfig() honors salt_chars"
handler = self.handler
if not has_salt_info(handler):
raise SkipTest
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py
index 9bae5b2..b49d3cd 100644
--- a/passlib/utils/__init__.py
+++ b/passlib/utils/__init__.py
@@ -32,8 +32,6 @@ __all__ = [
'is_crypt_context',
#byte manipulation
- "bytes_to_list",
- "list_to_bytes",
"xor_bytes",
#random