summaryrefslogtreecommitdiff
path: root/tests/test_bcrypt.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-05-11 00:20:52 -0400
committerDonald Stufft <donald@stufft.io>2013-05-11 00:20:52 -0400
commit6c74d9236d11cc146d82ee72cbebe65fcd03ca32 (patch)
treef5b4e04c7cee47ac3cc43910c74cb7ddca41af8b /tests/test_bcrypt.py
parent4ac208442047d925b8e972e22af5d68499c48cf0 (diff)
downloadpy-bcrypt-git-6c74d9236d11cc146d82ee72cbebe65fcd03ca32.tar.gz
Give a better error message when passing a text type to hashpw
Diffstat (limited to 'tests/test_bcrypt.py')
-rw-r--r--tests/test_bcrypt.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_bcrypt.py b/tests/test_bcrypt.py
index 476f919..41f5884 100644
--- a/tests/test_bcrypt.py
+++ b/tests/test_bcrypt.py
@@ -105,3 +105,13 @@ def test_hashpw_existing(password, hashed):
def test_hashpw_invalid():
with pytest.raises(ValueError):
bcrypt.hashpw(b"password", b"$2z$04$cVWp4XaNU8a4v1uMRum2SO")
+
+
+def test_hashpw_str_password():
+ with pytest.raises(TypeError):
+ bcrypt.hashpw(u"password", b"$2a$04$cVWp4XaNU8a4v1uMRum2SO")
+
+
+def test_hashpw_str_salt():
+ with pytest.raises(TypeError):
+ bcrypt.hashpw(b"password", u"$2a$04$cVWp4XaNU8a4v1uMRum2SO")