summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2020-01-30 10:35:02 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-30 11:19:50 +0100
commit579f33eb794fd868512226ecf452fc2bb0628a7c (patch)
tree28d36394234b57e7ef056e67715204bdd1d0625c
parentefc1c73bf511cbebf03fa5b13fa3a98718daf928 (diff)
Replaced assertWarns() with SimpleTestCase.assertWarnsMessage() in tests.
-rw-r--r--tests/auth_tests/test_hashers.py2
-rw-r--r--tests/cache/tests.py9
2 files changed, 7 insertions, 4 deletions
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index a837c967a7..754149dcea 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -462,7 +462,7 @@ class BasePasswordHasherTests(SimpleTestCase):
def test_harden_runtime(self):
msg = 'subclasses of BasePasswordHasher should provide a harden_runtime() method'
- with self.assertWarns(Warning, msg=msg):
+ with self.assertWarnsMessage(Warning, msg):
self.hasher.harden_runtime('password', 'encoded')
def test_must_update(self):
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 141d782203..097b42818a 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -97,7 +97,8 @@ class DummyCacheTests(SimpleTestCase):
self.assertEqual(cache.get_many(['a', 'b', 'e']), {})
def test_get_many_invalid_key(self):
- with self.assertWarns(CacheKeyWarning, msg=KEY_ERRORS_WITH_MEMCACHED_MSG % 'key with spaces'):
+ msg = KEY_ERRORS_WITH_MEMCACHED_MSG % ':1:key with spaces'
+ with self.assertWarnsMessage(CacheKeyWarning, msg):
cache.get_many(['key with spaces'])
def test_delete(self):
@@ -186,7 +187,8 @@ class DummyCacheTests(SimpleTestCase):
self.assertEqual(cache.set_many({'a': 1, 'b': 2}, timeout=2, version='1'), [])
def test_set_many_invalid_key(self):
- with self.assertWarns(CacheKeyWarning, msg=KEY_ERRORS_WITH_MEMCACHED_MSG % 'key with spaces'):
+ msg = KEY_ERRORS_WITH_MEMCACHED_MSG % ':1:key with spaces'
+ with self.assertWarnsMessage(CacheKeyWarning, msg):
cache.set_many({'key with spaces': 'foo'})
def test_delete_many(self):
@@ -194,7 +196,8 @@ class DummyCacheTests(SimpleTestCase):
cache.delete_many(['a', 'b'])
def test_delete_many_invalid_key(self):
- with self.assertWarns(CacheKeyWarning, msg=KEY_ERRORS_WITH_MEMCACHED_MSG % 'key with spaces'):
+ msg = KEY_ERRORS_WITH_MEMCACHED_MSG % ':1:key with spaces'
+ with self.assertWarnsMessage(CacheKeyWarning, msg):
cache.delete_many({'key with spaces': 'foo'})
def test_clear(self):