Skip to content

Commit fdf1b09

Browse files
Refactoring tests
1 parent ce4fbac commit fdf1b09

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

tests/functional/data_masking/required_dependencies/test_erase_data_masking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ def test_mask_nested_field_success(data_masker):
321321
# THEN the nested field should be masked while other data remains unchanged
322322
assert data_masked == {"user": {"contact": {"details": {"address": {"street": "123 Main St", "zip": "xxx"}}}}}
323323

324+
324325
def test_erase_dictionary_with_masking_rules(data_masker):
325326
# GIVEN a dictionary with nested sensitive data
326327
data = {"user": {"name": "John Doe", "ssn": "123-45-6789", "address": {"street": "123 Main St", "zip": "12345"}}}
@@ -411,6 +412,7 @@ def test_erase_handles_empty_string_with_dynamic_mask(data_masker):
411412
# THEN empty string should be returned
412413
assert result == ""
413414

415+
414416
def test_erase_dictionary_with_masking_rules_wrong_field(data_masker):
415417
# GIVEN a dictionary with nested sensitive data
416418
data = {"user": {"name": "John Doe", "ssn": "123-45-6789", "address": {"street": "123 Main St", "zip": "12345"}}}

tests/unit/data_masking/required_dependencies/test_base_functions.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
2-
import json
3-
41
import pytest
52

63
from aws_lambda_powertools.utilities.data_masking.base import DataMasking
7-
from aws_lambda_powertools.utilities.data_masking.constants import DATA_MASKING_STRING
8-
from aws_lambda_powertools.utilities.data_masking.exceptions import (
9-
DataMaskingFieldNotFoundError,
10-
DataMaskingUnsupportedTypeError,
11-
)
124

135

146
@pytest.fixture
157
def data_masker() -> DataMasking:
168
return DataMasking()
179

10+
1811
def test_mask_nested_field_with_non_dict_value(data_masker):
1912
# GIVEN nested data where a middle path component is not a dictionary
2013
data = {"user": {"contact": "not_a_dict", "details": {"ssn": "123-45-6789"}}} # This will stop the traversal

0 commit comments

Comments
 (0)