diff options
| author | Alex <git@ajschof.me> | 2025-02-17 16:49:21 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 16:49:21 +0000 |
| commit | 219ab7976938f5e6a2804e2096480bb242647b00 (patch) | |
| tree | 3f4c74045d582eb9352a89247e53d7e704c991ea /test/test_obfuscator.py | |
| parent | 00917b8ecf67de9e955479be555d74fcc8257020 (diff) | |
| parent | ea70f4889120bc01d2a5416b99e3faba9c28fe9d (diff) | |
| download | gdpr-obfuscator-219ab7976938f5e6a2804e2096480bb242647b00.tar.gz gdpr-obfuscator-219ab7976938f5e6a2804e2096480bb242647b00.zip | |
Merge pull request #4 from ajschofield/deepsource-transform-af52e817
style: format code with Autopep8, Black and Ruff Formatter
Diffstat (limited to 'test/test_obfuscator.py')
| -rw-r--r-- | test/test_obfuscator.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test_obfuscator.py b/test/test_obfuscator.py index cc7d2c1..4f61b16 100644 --- a/test/test_obfuscator.py +++ b/test/test_obfuscator.py @@ -1,7 +1,9 @@ from obfuscator.obfuscate import obfuscate -# Check if the function does what its supposed to and can obfuscate +# Check if the function does what its supposed to and can obfuscate # valid PII fields in a list of dictionaries + + def test_obfuscate_data_with_valid_pii_fields(): data = [ { @@ -36,9 +38,12 @@ def test_obfuscate_data_with_valid_pii_fields(): result = obfuscate(data, pii_fields) assert result == expected + # Check if the function can obfuscate data even when some PII # fields are missing from some of the data, returning a list of dictionaries # but with the missing PII fields obfuscated and the rest of the data intact + + def test_obfuscate_data_with_missing_pii_field(): data = [ {"student_id": "1234", "name": "John Smith", "course": "Software"}, @@ -63,7 +68,10 @@ def test_obfuscate_data_with_missing_pii_field(): result = obfuscate(data, pii_fields) assert result == expected + # Check if the function can handle an empty list of data, returning an empty list + + def test_obfuscate_data_with_no_data(): data = [] pii_fields = ["name", "email_address"] @@ -72,8 +80,11 @@ def test_obfuscate_data_with_no_data(): result = obfuscate(data, pii_fields) assert result == expected + # Check if the function can handle an empty list of PII fields, returning the data as is # without mutating it + + def test_obfuscate_data_with_empty_pii_fields(): data = [ { |
