summaryrefslogtreecommitdiff
path: root/testing/tests/perf/test_crypto.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2016-12-22 17:36:15 -0200
committerdrebs <drebs@leap.se>2016-12-22 17:36:15 -0200
commit8a463796bbaba3979234b0699d140947581421e7 (patch)
treed1e2ea96ed91ac66c7e52a30d16246a498ae9ed6 /testing/tests/perf/test_crypto.py
parentf072f18f317ea31e66c7890d672b5d2fd9f3ef14 (diff)
parente360a3a75999503cf45bfbbad69970a452cf3d32 (diff)
Merge tag '0.9.2'
Tag version 0.9.2 # gpg: Signature made Thu 22 Dec 2016 05:33:30 PM BRST # gpg: using RSA key 0x6071E70DCACC60B2 # gpg: Good signature from "drebs (work key) <db@leap.se>" [ultimate] # gpg: aka "drebs (work key) <drebs@leap.se>" [ultimate] # Impressão da chave primária: 9F73 295B 6306 E06F 3151 99AE 6071 E70D CACC 60B2
Diffstat (limited to 'testing/tests/perf/test_crypto.py')
-rw-r--r--testing/tests/perf/test_crypto.py81
1 files changed, 0 insertions, 81 deletions
diff --git a/testing/tests/perf/test_crypto.py b/testing/tests/perf/test_crypto.py
deleted file mode 100644
index be00560b..00000000
--- a/testing/tests/perf/test_crypto.py
+++ /dev/null
@@ -1,81 +0,0 @@
-import pytest
-import json
-from uuid import uuid4
-from leap.soledad.common.document import SoledadDocument
-from leap.soledad.client.crypto import encrypt_sym
-from leap.soledad.client.crypto import decrypt_sym
-
-
-def create_doc_encryption(size):
- @pytest.mark.benchmark(group="test_crypto_encrypt_doc")
- def test_doc_encryption(soledad_client, benchmark, payload):
- crypto = soledad_client()._crypto
-
- DOC_CONTENT = {'payload': payload(size)}
- doc = SoledadDocument(
- doc_id=uuid4().hex, rev='rev',
- json=json.dumps(DOC_CONTENT))
-
- benchmark(crypto.encrypt_doc, doc)
- return test_doc_encryption
-
-
-def create_doc_decryption(size):
- @pytest.mark.benchmark(group="test_crypto_decrypt_doc")
- def test_doc_decryption(soledad_client, benchmark, payload):
- crypto = soledad_client()._crypto
-
- DOC_CONTENT = {'payload': payload(size)}
- doc = SoledadDocument(
- doc_id=uuid4().hex, rev='rev',
- json=json.dumps(DOC_CONTENT))
- encrypted_doc = crypto.encrypt_doc(doc)
- doc.set_json(encrypted_doc)
-
- benchmark(crypto.decrypt_doc, doc)
- return test_doc_decryption
-
-
-test_encrypt_doc_10k = create_doc_encryption(10*1000)
-test_encrypt_doc_100k = create_doc_encryption(100*1000)
-test_encrypt_doc_500k = create_doc_encryption(500*1000)
-test_encrypt_doc_1M = create_doc_encryption(1000*1000)
-test_encrypt_doc_10M = create_doc_encryption(10*1000*1000)
-test_encrypt_doc_50M = create_doc_encryption(50*1000*1000)
-test_decrypt_doc_10k = create_doc_decryption(10*1000)
-test_decrypt_doc_100k = create_doc_decryption(100*1000)
-test_decrypt_doc_500k = create_doc_decryption(500*1000)
-test_decrypt_doc_1M = create_doc_decryption(1000*1000)
-test_decrypt_doc_10M = create_doc_decryption(10*1000*1000)
-test_decrypt_doc_50M = create_doc_decryption(50*1000*1000)
-
-
-def create_raw_encryption(size):
- @pytest.mark.benchmark(group="test_crypto_raw_encrypt")
- def test_raw_encrypt(benchmark, payload):
- key = payload(32)
- benchmark(encrypt_sym, payload(size), key)
- return test_raw_encrypt
-
-
-def create_raw_decryption(size):
- @pytest.mark.benchmark(group="test_crypto_raw_decrypt")
- def test_raw_decrypt(benchmark, payload):
- key = payload(32)
- iv, ciphertext = encrypt_sym(payload(size), key)
- benchmark(decrypt_sym, ciphertext, key, iv)
- return test_raw_decrypt
-
-
-test_encrypt_raw_10k = create_raw_encryption(10*1000)
-test_encrypt_raw_100k = create_raw_encryption(100*1000)
-test_encrypt_raw_500k = create_raw_encryption(500*1000)
-test_encrypt_raw_1M = create_raw_encryption(1000*1000)
-test_encrypt_raw_10M = create_raw_encryption(10*1000*1000)
-test_encrypt_raw_50M = create_raw_encryption(50*1000*1000)
-test_decrypt_raw_10k = create_raw_decryption(10*1000)
-test_decrypt_raw_100k = create_raw_decryption(100*1000)
-test_decrypt_raw_500k = create_raw_decryption(500*1000)
-test_decrypt_raw_1M = create_raw_decryption(1000*1000)
-test_decrypt_raw_10M = create_raw_decryption(10*1000*1000)
-test_decrypt_raw_50M = create_raw_decryption(50*1000*1000)