Verified Commit fcdcd596 authored by Victor's avatar Victor
Browse files

[test] ciphertext size function tests

parent 390703b4
......@@ -126,6 +126,19 @@ class BlobTestCase(unittest.TestCase):
decrypted = yield decryptor.decrypt()
assert decrypted.getvalue() == snowden1
def test_get_unarmored_ciphertext_size(self):
for size_to_test in xrange(-1, 400):
test_content = '\x00' * size_to_test
size = _crypto.get_unarmored_ciphertext_size(len(test_content))
inf = BytesIO(test_content)
blob = _crypto.BlobEncryptor(
self.doc_info, inf,
secret='A' * 96)
encrypted = yield blob.encrypt()
assert len(encrypted.getvalue()) == size, size_to_test
def test_default_armored_blob_encrypt(self):
encrypted = yield self.blob.encrypt()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment