Skip to content

Commit

Permalink
Adding text + increasing perf threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrodamascena committed Dec 20, 2023
1 parent fbed1a1 commit d89cbcc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/utilities/data_masking.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ Here are common scenarios to best visualize how to use `fields`.

> Expression: `data_masker.mask(data, fields=["$.address[?(@.postcode > 81846)]"])`

> `$`: Represents the root of the JSON structure.

> `.address`: Selects the "address" property within the JSON structure.

> `(@.postcode > 81846)`: Specifies the condition that elements should meet. It selects elements where the value of the `postcode` property is `greater than 81846`.

```json hl_lines="8 12"
--8<-- "examples/data_masking/src/choosing_payload_complex_search.json"
```
Expand Down
2 changes: 1 addition & 1 deletion tests/performance/data_masking/test_perf_data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

DATA_MASKING_PACKAGE = "aws_lambda_powertools.utilities._data_masking"
DATA_MASKING_INIT_SLA: float = 0.002
DATA_MASKING_NESTED_ENCRYPT_SLA: float = 0.01
DATA_MASKING_NESTED_ENCRYPT_SLA: float = 0.05

json_blob = {
"id": 1,
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/data_masking/test_unit_data_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def test_parsing_unsupported_data_type(data_masker):
data_masker.mask(42, ["this.field"])


def test_parsing_with_empty_field(data_masker):
# GIVEN an initialization of the DataMasking class

# WHEN attempting to pass in a list of fields with input data that is not a dict
with pytest.raises(ValueError):
# THEN the result is a TypeError
data_masker.mask(42, [])


def test_parsing_nonexistent_fields_with_raise_on_missing_field():
# GIVEN a dict data type

Expand Down

0 comments on commit d89cbcc

Please sign in to comment.