Docs, tests, typing

This commit is contained in:
2021-10-09 14:53:28 +02:00
parent 7fbdb2a73c
commit f04eb3c14b
2 changed files with 66 additions and 8 deletions

View File

@@ -94,6 +94,19 @@ def test_container_init():
try:
cryptbase.cryptbase.CryptoContainer(encryptor=None, plaintext=None)
assert False
except ValueError:
pass
class DummyEncryptor(cryptbase.cryptbase.Encryptor):
def encrypt(self, plaintext):
return None, None
def decrypt(self, ct, iv):
return None
try:
cryptbase.cryptbase.CryptoContainer(encryptor=DummyEncryptor(), plaintext=None)
assert False
except AttributeError:
pass
@@ -112,5 +125,11 @@ def test_container_init():
try:
cryptbase.cryptbase.CryptoContainer(encryptor=None, ciphertext=None, iv=None)
assert False
except ValueError:
pass
try:
cryptbase.cryptbase.CryptoContainer(encryptor=DummyEncryptor(), ciphertext=None, iv=None)
assert False
except AttributeError:
pass