Merge branch 'python/drop-hypothesis' into 'master'
tests: Drop hypothesis from the python tests. See merge request matrix-org/olm!5
This commit is contained in:
commit
c463d8b55b
3 changed files with 11 additions and 18 deletions
|
@ -1,5 +1,4 @@
|
||||||
pytest
|
pytest
|
||||||
hypothesis
|
|
||||||
pytest-flake8
|
pytest-flake8
|
||||||
pytest-isort
|
pytest-isort
|
||||||
pytest-cov
|
pytest-cov
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
from builtins import int
|
from builtins import int
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from hypothesis import given
|
|
||||||
from hypothesis.strategies import text
|
|
||||||
|
|
||||||
from olm import Account, OlmAccountError, OlmVerifyError, ed25519_verify
|
from olm import Account, OlmAccountError, OlmVerifyError, ed25519_verify
|
||||||
from olm._compat import to_bytes
|
from olm._compat import to_bytes
|
||||||
|
@ -73,8 +71,8 @@ class TestClass(object):
|
||||||
alice = Account()
|
alice = Account()
|
||||||
del alice
|
del alice
|
||||||
|
|
||||||
@given(text())
|
def test_valid_signature(self):
|
||||||
def test_valid_signature(self, message):
|
message = "It's a secret to everybody"
|
||||||
alice = Account()
|
alice = Account()
|
||||||
|
|
||||||
signature = alice.sign(message)
|
signature = alice.sign(message)
|
||||||
|
@ -85,8 +83,8 @@ class TestClass(object):
|
||||||
|
|
||||||
ed25519_verify(signing_key, message, signature)
|
ed25519_verify(signing_key, message, signature)
|
||||||
|
|
||||||
@given(text())
|
def test_invalid_signature(self):
|
||||||
def test_invalid_signature(self, message):
|
message = "It's a secret to everybody"
|
||||||
alice = Account()
|
alice = Account()
|
||||||
bob = Account()
|
bob = Account()
|
||||||
|
|
||||||
|
@ -99,8 +97,8 @@ class TestClass(object):
|
||||||
with pytest.raises(OlmVerifyError):
|
with pytest.raises(OlmVerifyError):
|
||||||
ed25519_verify(signing_key, message, signature)
|
ed25519_verify(signing_key, message, signature)
|
||||||
|
|
||||||
@given(text())
|
def test_signature_verification_twice(self):
|
||||||
def test_signature_verification_twice(self, message):
|
message = "It's a secret to everybody"
|
||||||
alice = Account()
|
alice = Account()
|
||||||
|
|
||||||
signature = alice.sign(message)
|
signature = alice.sign(message)
|
||||||
|
|
|
@ -2,16 +2,16 @@ import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from future.utils import bytes_to_native_str
|
from future.utils import bytes_to_native_str
|
||||||
from hypothesis import given
|
|
||||||
from hypothesis.strategies import text
|
|
||||||
|
|
||||||
from olm import sha256
|
from olm import sha256
|
||||||
from olm._compat import to_bytes
|
from olm._compat import to_bytes
|
||||||
|
|
||||||
|
|
||||||
class TestClass(object):
|
class TestClass(object):
|
||||||
@given(text(), text())
|
def test_sha256(self):
|
||||||
def test_sha256(self, input1, input2):
|
input1 = "It's a secret to everybody"
|
||||||
|
input2 = "It's a secret to nobody"
|
||||||
|
|
||||||
first_hash = sha256(input1)
|
first_hash = sha256(input1)
|
||||||
second_hash = sha256(input2)
|
second_hash = sha256(input2)
|
||||||
|
|
||||||
|
@ -21,9 +21,5 @@ class TestClass(object):
|
||||||
|
|
||||||
hashlib_hash = bytes_to_native_str(hashlib_hash[:-1])
|
hashlib_hash = bytes_to_native_str(hashlib_hash[:-1])
|
||||||
|
|
||||||
if input1 == input2:
|
assert first_hash != second_hash
|
||||||
assert first_hash == second_hash
|
|
||||||
else:
|
|
||||||
assert first_hash != second_hash
|
|
||||||
|
|
||||||
assert hashlib_hash == first_hash
|
assert hashlib_hash == first_hash
|
||||||
|
|
Loading…
Reference in a new issue