import os
import time

import pytest

from security import Security


@pytest.mark.performance
def test_pt_enc_01_encrypt_decrypt_10mb_within_five_seconds():
    key = "test-key"
    data = os.urandom(10 * 1024 * 1024)
    t0 = time.perf_counter()
    enc = Security.encrypt_to(data, key)
    out = Security.decrypt_to(enc, key)
    elapsed = time.perf_counter() - t0
    assert elapsed <= 5.0
    assert out == data
