summaryrefslogtreecommitdiff
path: root/tests/test_bcrypt.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2014-12-06 16:19:29 -0500
committerDonald Stufft <donald@stufft.io>2014-12-06 16:19:29 -0500
commitc87a1f0d072083b1f0a30eaebe23f06c9231c2db (patch)
tree8235cccfe5bc8dc72825a315562810c1d9b9a8eb /tests/test_bcrypt.py
parent5a729ea020632692d42fae5cf282e8bf8e40b9c6 (diff)
parent2801b7b816ea67e3fabfbfe23cde6c838363c721 (diff)
downloadpy-bcrypt-git-c87a1f0d072083b1f0a30eaebe23f06c9231c2db.tar.gz
Merge pull request #31 from alex/no-more-mock
Removed usage of mock which wasn't really doing anything
Diffstat (limited to 'tests/test_bcrypt.py')
-rw-r--r--tests/test_bcrypt.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/test_bcrypt.py b/tests/test_bcrypt.py
index 99b7a50..e6329a6 100644
--- a/tests/test_bcrypt.py
+++ b/tests/test_bcrypt.py
@@ -1,7 +1,5 @@
import os
-import mock
-
import pytest
import six
@@ -15,8 +13,7 @@ def test_raise_implicit_compile():
def test_gensalt_basic(monkeypatch):
- urandom = mock.Mock(return_value=b"0000000000000000")
- monkeypatch.setattr(os, "urandom", urandom)
+ monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000")
assert bcrypt.gensalt() == b"$2a$12$KB.uKB.uKB.uKB.uKB.uK."
@@ -44,15 +41,13 @@ def test_gensalt_basic(monkeypatch):
(24, b"$2a$24$KB.uKB.uKB.uKB.uKB.uK."),
])
def test_gensalt_rounds_valid(rounds, expected, monkeypatch):
- urandom = mock.Mock(return_value=b"0000000000000000")
- monkeypatch.setattr(os, "urandom", urandom)
+ monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000")
assert bcrypt.gensalt(rounds) == expected
@pytest.mark.parametrize("rounds", list(range(1, 4)))
def test_gensalt_rounds_invalid(rounds, monkeypatch):
- urandom = mock.Mock(return_value=b"0000000000000000")
- monkeypatch.setattr(os, "urandom", urandom)
+ monkeypatch.setattr(os, "urandom", lambda n: b"0000000000000000")
with pytest.raises(ValueError):
bcrypt.gensalt(rounds)