summaryrefslogtreecommitdiff
path: root/passlib
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2015-07-25 22:30:56 -0400
committerEli Collins <elic@assurancetechnologies.com>2015-07-25 22:30:56 -0400
commita2440f7d568867916c011a1a7920d7d3e11ab369 (patch)
treefcdd9aeee646b56fb0c01b6826d74e894a14c1ba /passlib
parent80f093c922b64dfaedd00194a2fe16648fe2a8d0 (diff)
downloadpasslib-a2440f7d568867916c011a1a7920d7d3e11ab369.tar.gz
tests: minor fix so HasRounds.bitsize() test isn't dependant on hardcoded
default rounds values. serves me right for tweaking the default rounds *after* a release.
Diffstat (limited to 'passlib')
-rw-r--r--passlib/tests/test_utils_handlers.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/passlib/tests/test_utils_handlers.py b/passlib/tests/test_utils_handlers.py
index 8e408ca..0b5522d 100644
--- a/passlib/tests/test_utils_handlers.py
+++ b/passlib/tests/test_utils_handlers.py
@@ -18,7 +18,7 @@ from passlib.utils import getrandstr, JYTHON, rng
from passlib.utils.compat import b, bytes, bascii_to_str, str_to_uascii, \
uascii_to_str, unicode, PY_MAX_25, SUPPORTS_DIR_METHOD
import passlib.utils.handlers as uh
-from passlib.tests.utils import HandlerCase, TestCase, catch_warnings
+from passlib.tests.utils import HandlerCase, TestCase, catch_warnings, patchAttr
from passlib.utils.compat import u, PY3
# module
log = getLogger(__name__)
@@ -44,6 +44,8 @@ def _makelang(alphabet, size):
class SkeletonTest(TestCase):
"""test hash support classes"""
+ patchAttr = patchAttr
+
#===================================================================
# StaticHandler
#===================================================================
@@ -524,10 +526,14 @@ class SkeletonTest(TestCase):
{'checksum': 186, 'salt': 132})
# linear rounds
+ # NOTE: +3 comes from int(math.log(.1,2)),
+ # where 0.1 = 10% = default allowed variation in rounds
+ self.patchAttr(hash.sha256_crypt, "default_rounds", 1 << (14 + 3))
self.assertEqual(hash.sha256_crypt.bitsize(),
{'checksum': 258, 'rounds': 14, 'salt': 96})
# raw checksum
+ self.patchAttr(hash.pbkdf2_sha1, "default_rounds", 1 << (13 + 3))
self.assertEqual(hash.pbkdf2_sha1.bitsize(),
{'checksum': 160, 'rounds': 13, 'salt': 128})