summaryrefslogtreecommitdiff
path: root/passlib/tests/test_utils_handlers.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2020-10-06 15:08:56 -0400
committerEli Collins <elic@assurancetechnologies.com>2020-10-06 15:08:56 -0400
commit3709566d41523e5bc31e1063b647e90f1469744a (patch)
treee29eed3fa76fad9373432cda397ff7dc9cb24e4e /passlib/tests/test_utils_handlers.py
parent56017e683f8e31be252c94f23d4dd22a2d5603f9 (diff)
downloadpasslib-3709566d41523e5bc31e1063b647e90f1469744a.tar.gz
cleanup old python compat -- replaced "unicode" alias in favor of "str"
Diffstat (limited to 'passlib/tests/test_utils_handlers.py')
-rw-r--r--passlib/tests/test_utils_handlers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/passlib/tests/test_utils_handlers.py b/passlib/tests/test_utils_handlers.py
index 0a98978..8527304 100644
--- a/passlib/tests/test_utils_handlers.py
+++ b/passlib/tests/test_utils_handlers.py
@@ -12,7 +12,7 @@ import warnings
from passlib.hash import ldap_md5, sha256_crypt
from passlib.exc import MissingBackendError, PasslibHashWarning
from passlib.utils.compat import str_to_uascii, \
- uascii_to_str, unicode
+ uascii_to_str
import passlib.utils.handlers as uh
from passlib.tests.utils import HandlerCase, TestCase
# module
@@ -155,7 +155,7 @@ class SkeletonTest(TestCase):
# relaxed
# NOTE: this could be turned back on if we test _norm_checksum() directly...
- #with self.assertWarningList("checksum should be unicode"):
+ #with self.assertWarningList("checksum should be str"):
# self.assertEqual(norm_checksum(b'xxzx', relaxed=True), u'xxzx')
#self.assertRaises(TypeError, norm_checksum, 1, relaxed=True)
@@ -174,7 +174,7 @@ class SkeletonTest(TestCase):
# test bytes
self.assertEqual(norm_checksum(b'1234'), b'1234')
- # test unicode
+ # test str
self.assertRaises(TypeError, norm_checksum, u'xxyx')
# NOTE: this could be turned back on if we test _norm_checksum() directly...
@@ -746,7 +746,7 @@ class UnsaltedHash(uh.StaticHandler):
checksum_size = 40
def _calc_checksum(self, secret):
- if isinstance(secret, unicode):
+ if isinstance(secret, str):
secret = secret.encode("utf-8")
data = b"boblious" + secret
return str_to_uascii(hashlib.sha1(data).hexdigest())
@@ -776,7 +776,7 @@ class SaltedHash(uh.HasSalt, uh.GenericHandler):
return uascii_to_str(hash)
def _calc_checksum(self, secret):
- if isinstance(secret, unicode):
+ if isinstance(secret, str):
secret = secret.encode("utf-8")
data = self.salt.encode("ascii") + secret + self.salt.encode("ascii")
return str_to_uascii(hashlib.sha1(data).hexdigest())