diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-06 10:33:12 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-06 10:33:12 -0800 |
commit | 2801b7b816ea67e3fabfbfe23cde6c838363c721 (patch) | |
tree | 8601670c3592897e8c088c9a804f8e8d3885153c /tests/test_bcrypt.py | |
parent | c13b1e80fdde97b05756f3cccdbb0559a72798e5 (diff) | |
download | py-bcrypt-git-2801b7b816ea67e3fabfbfe23cde6c838363c721.tar.gz |
Removed usage of mock which wasn't really doing anything
Diffstat (limited to 'tests/test_bcrypt.py')
-rw-r--r-- | tests/test_bcrypt.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/test_bcrypt.py b/tests/test_bcrypt.py index bb32299..3dc1ca1 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",), [[x] for x in 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) |