diff options
| author | Alex Schofield <git@ajschof.me> | 2025-02-26 19:44:03 +0000 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2025-02-26 19:44:03 +0000 |
| commit | 1b8ee8a812e58cbb0632d49d1ff2fc6a0b925d6b (patch) | |
| tree | c10550f61b887d3cb6df411183816ddfa602e18e /test/test_core.py | |
| parent | 50e6dd17c6f97026d0a830ca5f6c011aea7cc1db (diff) | |
| download | gdpr-obfuscator-1b8ee8a812e58cbb0632d49d1ff2fc6a0b925d6b.tar.gz gdpr-obfuscator-1b8ee8a812e58cbb0632d49d1ff2fc6a0b925d6b.zip | |
add test in test_core.py to measure if completed under 1 min
Diffstat (limited to 'test/test_core.py')
| -rw-r--r-- | test/test_core.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_core.py b/test/test_core.py index 8ee4197..bb28607 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -5,6 +5,7 @@ import boto3 import csv import random import json +import time obfuscator = Obfuscator() @@ -47,3 +48,27 @@ def test_imported_module_runs_successfully_with_local_data(): result_str = result.decode("utf-8") assert rand_name not in result_str + + +def test_imported_module_completes_in_under_one_minute(): + with mock_aws(): + s3 = boto3.client("s3", region_name="eu-west-2") + bucket = "test-bucket" + key = "data/large_dataset.csv" + + with open("test/data/large_dataset.csv", "r") as f: + csv_content = f.read() + + setup_s3(s3, bucket, key, csv_content) + + path = f"s3://{bucket}/{key}" + + json_input = json.dumps( + {"file_path": path, "pii_fields": ["full_name", "email_address"]} + ) + + start = time.time() + obfuscator.process_s3(json_input) + end = time.time() + + assert end - start < 60 |
