From 125c62098c35e2e7fcf4ad916d764a5a69edd9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 20 Jun 2019 13:45:33 +0200 Subject: tests: Drop hypothesis from the tests. Hypothesis recently had some problems with the typing module breaking the tox tests. Since Hypothesis isn't really used much in the test this patch removes it from them as well as from the test-requirements. --- python/test-requirements.txt | 1 - python/tests/account_test.py | 14 ++++++-------- python/tests/utils_test.py | 8 ++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/python/test-requirements.txt b/python/test-requirements.txt index eb89250..b18f27f 100644 --- a/python/test-requirements.txt +++ b/python/test-requirements.txt @@ -1,5 +1,4 @@ pytest -hypothesis pytest-flake8 pytest-isort pytest-cov diff --git a/python/tests/account_test.py b/python/tests/account_test.py index 7ee6d2b..f3b71eb 100644 --- a/python/tests/account_test.py +++ b/python/tests/account_test.py @@ -1,8 +1,6 @@ from builtins import int import pytest -from hypothesis import given -from hypothesis.strategies import text from olm import Account, OlmAccountError, OlmVerifyError, ed25519_verify from olm._compat import to_bytes @@ -73,8 +71,8 @@ class TestClass(object): alice = Account() del alice - @given(text()) - def test_valid_signature(self, message): + def test_valid_signature(self): + message = "It's a secret to everybody" alice = Account() signature = alice.sign(message) @@ -85,8 +83,8 @@ class TestClass(object): ed25519_verify(signing_key, message, signature) - @given(text()) - def test_invalid_signature(self, message): + def test_invalid_signature(self): + message = "It's a secret to everybody" alice = Account() bob = Account() @@ -99,8 +97,8 @@ class TestClass(object): with pytest.raises(OlmVerifyError): ed25519_verify(signing_key, message, signature) - @given(text()) - def test_signature_verification_twice(self, message): + def test_signature_verification_twice(self): + message = "It's a secret to everybody" alice = Account() signature = alice.sign(message) diff --git a/python/tests/utils_test.py b/python/tests/utils_test.py index a552d12..9d22157 100644 --- a/python/tests/utils_test.py +++ b/python/tests/utils_test.py @@ -2,16 +2,16 @@ import base64 import hashlib from future.utils import bytes_to_native_str -from hypothesis import given -from hypothesis.strategies import text from olm import sha256 from olm._compat import to_bytes class TestClass(object): - @given(text(), text()) - def test_sha256(self, input1, input2): + def test_sha256(self): + input1 = "It's a secret to everybody" + input2 = "It's a secret to nobody" + first_hash = sha256(input1) second_hash = sha256(input2) -- cgit v1.2.3 From 5d7070d2f365b54ee40e481483f35352cdfe53f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 20 Jun 2019 13:54:25 +0200 Subject: tests: Simplify the sha256 tests for python. Hypothesis isn't used anymore and the strings are now constants, meaning that the hashes should never match. --- python/tests/utils_test.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/python/tests/utils_test.py b/python/tests/utils_test.py index 9d22157..86fb34f 100644 --- a/python/tests/utils_test.py +++ b/python/tests/utils_test.py @@ -21,9 +21,5 @@ class TestClass(object): hashlib_hash = bytes_to_native_str(hashlib_hash[:-1]) - if input1 == input2: - assert first_hash == second_hash - else: - assert first_hash != second_hash - + assert first_hash != second_hash assert hashlib_hash == first_hash -- cgit v1.2.3