Skip to content
Snippets Groups Projects
Verified Commit fcdcd596 authored by Victor's avatar Victor
Browse files

[test] ciphertext size function tests

parent 390703b4
No related branches found
No related tags found
1 merge request!172Upstreaming blobs
......@@ -126,6 +126,19 @@ class BlobTestCase(unittest.TestCase):
decrypted = yield decryptor.decrypt()
assert decrypted.getvalue() == snowden1
@defer.inlineCallbacks
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,
armor=False,
secret='A' * 96)
encrypted = yield blob.encrypt()
assert len(encrypted.getvalue()) == size, size_to_test
@defer.inlineCallbacks
def test_default_armored_blob_encrypt(self):
encrypted = yield self.blob.encrypt()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment