aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_obfuscator.py
diff options
context:
space:
mode:
authorAlex <git@ajschof.me>2025-02-17 16:47:47 +0000
committerGitHub <noreply@github.com>2025-02-17 16:47:47 +0000
commit00917b8ecf67de9e955479be555d74fcc8257020 (patch)
tree17dd9b2e85866f85bdbb3702185463b13c911a28 /test/test_obfuscator.py
parentbf323b8c2ebd47bb446ba773027f389a0887e325 (diff)
parente2b0f2553b8dfcbe39f6e6fdc86ca68cc63f5705 (diff)
downloadgdpr-obfuscator-00917b8ecf67de9e955479be555d74fcc8257020.tar.gz
gdpr-obfuscator-00917b8ecf67de9e955479be555d74fcc8257020.zip
Merge pull request #3 from ajschofield/add-docs
update README & add comments in src code
Diffstat (limited to 'test/test_obfuscator.py')
-rw-r--r--test/test_obfuscator.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_obfuscator.py b/test/test_obfuscator.py
index c77b6b4..cc7d2c1 100644
--- a/test/test_obfuscator.py
+++ b/test/test_obfuscator.py
@@ -1,6 +1,7 @@
from obfuscator.obfuscate import 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 = [
{
@@ -35,7 +36,9 @@ 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"},
@@ -60,7 +63,7 @@ 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"]
@@ -69,7 +72,8 @@ 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 = [
{
git.ajschof.me — hosted by ajschofield — powered by cgit