[1.4.x] Removed usage of b"" string syntax for Python 2.5 compatibility.

Refs commit 3f3d887a6844ec2db743fee64c9e53e04d39a368.
This commit is contained in:
Russell Keith-Magee 2013-09-15 14:02:38 +08:00
parent 3ffc7b52f8
commit 6903d1690a

View File

@ -33,7 +33,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
) )
def test_pkbdf2(self): def test_pkbdf2(self):
@ -47,7 +47,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"seasalt", "seasalt",
"pbkdf2_sha256", "pbkdf2_sha256",
) )
@ -63,7 +63,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"seasalt", "seasalt",
"sha1", "sha1",
) )
@ -79,7 +79,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"seasalt", "seasalt",
"md5", "md5",
) )
@ -99,7 +99,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"", "",
"unsalted_md5", "unsalted_md5",
) )
@ -117,7 +117,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"", "",
"unslated_sha1", "unslated_sha1",
) )
@ -133,7 +133,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
"seasalt", "seasalt",
"crypt", "crypt",
) )
@ -149,7 +149,7 @@ class TestUtilsHashPass(unittest.TestCase):
self.assertRaises( self.assertRaises(
ValueError, ValueError,
make_password, make_password,
b"1" * (MAXIMUM_PASSWORD_LENGTH + 1), "1" * (MAXIMUM_PASSWORD_LENGTH + 1),
hasher="bcrypt", hasher="bcrypt",
) )
@ -172,8 +172,8 @@ class TestUtilsHashPass(unittest.TestCase):
def encode(s, password, salt): def encode(s, password, salt):
return True return True
self.assertTrue(encode(None, b"1234", b"1234")) self.assertTrue(encode(None, "1234", "1234"))
self.assertRaises(ValueError, encode, None, b"1234567890A", b"1234") self.assertRaises(ValueError, encode, None, "1234567890A", "1234")
def test_low_level_pkbdf2(self): def test_low_level_pkbdf2(self):
hasher = PBKDF2PasswordHasher() hasher = PBKDF2PasswordHasher()