summaryrefslogtreecommitdiff
path: root/passlib/tests/test_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/tests/test_context.py')
-rw-r--r--passlib/tests/test_context.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/passlib/tests/test_context.py b/passlib/tests/test_context.py
index c3bf622..f788ee9 100644
--- a/passlib/tests/test_context.py
+++ b/passlib/tests/test_context.py
@@ -22,7 +22,7 @@ from passlib.exc import PasslibConfigWarning
from passlib.utils import tick, to_bytes, to_unicode
from passlib.utils.compat import irange, u
import passlib.utils.handlers as uh
-from passlib.tests.utils import TestCase, mktemp, catch_warnings, \
+from passlib.tests.utils import TestCase, mktemp, catch_all_warnings, \
gae_env, set_file
from passlib.registry import register_crypt_handler_path, has_crypt_handler, \
_unload_handler_name as unload_handler_name
@@ -467,7 +467,7 @@ admin__context__deprecated = des_crypt, bsdi_crypt
def test_15_min_verify_time(self):
"test get_min_verify_time() method"
# silence deprecation warnings for min verify time
- with catch_warnings():
+ with catch_all_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
self._test_15()
@@ -624,7 +624,7 @@ class CryptContextTest(TestCase):
)
# min rounds
- with catch_warnings(record=True) as wlog:
+ with catch_all_warnings(record=True) as wlog:
# set below handler min
c2 = cc.replace(all__min_rounds=500, all__max_rounds=None,
@@ -655,7 +655,7 @@ class CryptContextTest(TestCase):
self.consumeWarningList(wlog)
# max rounds
- with catch_warnings(record=True) as wlog:
+ with catch_all_warnings(record=True) as wlog:
# set above handler max
c2 = cc.replace(all__max_rounds=int(1e9)+500, all__min_rounds=None,
all__default_rounds=int(1e9)+500)
@@ -816,7 +816,7 @@ class CryptContextTest(TestCase):
# which is much cheaper, and shares the same codebase.
# min rounds
- with catch_warnings(record=True) as wlog:
+ with catch_all_warnings(record=True) as wlog:
self.assertEqual(
cc.encrypt("password", rounds=1999, salt="nacl"),
'$5$rounds=2000$nacl$9/lTZ5nrfPuz8vphznnmHuDGFuvjSNvOEDsGmGfsS97',
@@ -827,7 +827,7 @@ class CryptContextTest(TestCase):
cc.encrypt("password", rounds=2001, salt="nacl"),
'$5$rounds=2001$nacl$8PdeoPL4aXQnJ0woHhqgIw/efyfCKC2WHneOpnvF.31'
)
- self.consumeWarningList()
+ self.consumeWarningList(wlog)
# max rounds, etc tested in genconfig()
@@ -942,7 +942,7 @@ class CryptContextTest(TestCase):
return to_unicode(secret + 'x')
# silence deprecation warnings for min verify time
- with catch_warnings(record=True) as wlog:
+ with catch_all_warnings(record=True) as wlog:
cc = CryptContext([TimedHash], min_verify_time=min_verify_time)
self.consumeWarningList(wlog, DeprecationWarning)
@@ -969,7 +969,7 @@ class CryptContextTest(TestCase):
#ensure taking longer emits a warning.
TimedHash.delay = max_delay
- with catch_warnings(record=True) as wlog:
+ with catch_all_warnings(record=True) as wlog:
elapsed, result = timecall(cc.verify, "blob", "stubx")
self.assertFalse(result)
self.assertAlmostEqual(elapsed, max_delay, delta=delta)
@@ -1016,9 +1016,7 @@ class CryptContextTest(TestCase):
GOOD1 = "$2a$12$oaQbBqq8JnSM1NHRPQGXOOm4GCUMqp7meTnkft4zgSnrbhoKdDV0C"
ctx = CryptContext(["bcrypt"])
- with catch_warnings(record=True) as wlog:
- warnings.simplefilter("always")
-
+ with catch_all_warnings(record=True) as wlog:
self.assertTrue(ctx.hash_needs_update(BAD1))
self.assertFalse(ctx.hash_needs_update(GOOD1))