Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -351,25 +351,25 @@ def test_encrypt_with_complex_dict(data_masker):
# GIVEN the data type is a json representation of a dictionary with a list inside
data = json.dumps(
{
"name": "Leandro",
"name": "Pat",
"operation": "non sensitive",
"card_number": "1000 4444 333 2222",
"address": [
{
"postcode": 81847,
"street": "38986 Joanne Stravenue",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/La_Paz",
},
{
"postcode": 94400,
"street": "623 Kraig Mall",
"postcode": 10000,
"street": "100 Main Street",
"country": "United States",
"timezone": "America/Mazatlan",
},
{
"postcode": 94480,
"street": "123 Kraig Mall",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/Mazatlan",
},
Expand All @@ -389,25 +389,25 @@ def test_encrypt_with_slice(data_masker):
# GIVEN the data type is a json representation of a dictionary with a list inside
data = json.dumps(
{
"name": "Leandro",
"name": "Pat",
"operation": "non sensitive",
"card_number": "1000 4444 333 2222",
"address": [
{
"postcode": 81847,
"street": "38986 Joanne Stravenue",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/La_Paz",
},
{
"postcode": 94400,
"street": "623 Kraig Mall",
"postcode": 10000,
"street": "100 Main Street",
"country": "United States",
"timezone": "America/Mazatlan",
},
{
"postcode": 94480,
"street": "123 Kraig Mall",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/Mazatlan",
},
Expand All @@ -427,25 +427,25 @@ def test_encrypt_with_complex_search(data_masker):
# GIVEN the data type is a json representation of a dictionary with a list inside
data = json.dumps(
{
"name": "Leandro",
"name": "Pat",
"operation": "non sensitive",
"card_number": "1000 4444 333 2222",
"address": [
{
"postcode": 81847,
"street": "38986 Joanne Stravenue",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/La_Paz",
},
{
"postcode": 94400,
"street": "623 Kraig Mall",
"postcode": 10000,
"street": "100 Main Street",
"country": "United States",
"timezone": "America/Mazatlan",
},
{
"postcode": 94480,
"street": "123 Kraig Mall",
"postcode": 10001,
"street": "123 Any Street, Any Town",
"country": "United States",
"timezone": "America/Mazatlan",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def test_erase_dictionary_with_masking_rules(data_masker):

def test_erase_dictionary_with_masking_rules_with_list(data_masker):
# GIVEN a dictionary with nested sensitive data
data = {"user": {"name": ["leandro", "powertools"]}}
data = {"user": {"name": ["Pat", "powertools"]}}

# AND masking rules for specific fields
masking_rules = {"user.name": {"custom_mask": "NO-NAME"}}
Expand All @@ -393,15 +393,15 @@ def test_erase_dictionary_with_masking_rules_with_list(data_masker):

def test_erase_list_with_custom_mask(data_masker):
# GIVEN a dictionary with nested sensitive data
data = {"user": {"name": ["leandro", "powertools"]}}
data = {"user": {"name": ["Pat", "powertools"]}}

# WHEN erase is called with masking rules
result = data_masker.erase(data, fields=["user.name"], dynamic_mask=True)

# THEN only the specified fields should be masked
assert result == {
"user": {
"name": ["*******", "**********"],
"name": ["***", "**********"],
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ def test_api_gateway_app_with_strip_prefix_and_route_prefix():
app = ApiGatewayResolver(strip_prefixes=["/v1"])
router = Router()

event = {"httpMethod": "GET", "path": "/v1/users/leandro", "resource": "/users"}
event = {"httpMethod": "GET", "path": "/v1/users/pat", "resource": "/users"}

@router.get("<user_id>")
def base(user_id: str):
Expand Down
28 changes: 14 additions & 14 deletions tests/functional/feature_flags/_boto3/test_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ def test_flags_any_in_value_match(mocker, config):
{
"action": RuleAction.ANY_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1470,7 +1470,7 @@ def test_flags_any_in_value_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Gerald"]},
context={"tenant_id": ["Akua"]},
default=False,
)
assert toggle == expected_value
Expand All @@ -1488,7 +1488,7 @@ def test_flags_any_in_value_no_match(mocker, config):
{
"action": RuleAction.ANY_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1499,7 +1499,7 @@ def test_flags_any_in_value_no_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Simon"]},
context={"tenant_id": ["Kwesi"]},
default=False,
)
assert toggle == expected_value
Expand All @@ -1517,7 +1517,7 @@ def test_flags_all_in_value_match(mocker, config):
{
"action": RuleAction.ALL_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1528,7 +1528,7 @@ def test_flags_all_in_value_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Gerald"]},
context={"tenant_id": ["Akua"]},
default=False,
)

Expand All @@ -1547,7 +1547,7 @@ def test_flags_all_in_value_no_match(mocker, config):
{
"action": RuleAction.ALL_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1558,7 +1558,7 @@ def test_flags_all_in_value_no_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Gerald", "Simon"]},
context={"tenant_id": ["Akua", "Mary"]},
default=False,
)

Expand All @@ -1577,7 +1577,7 @@ def test_flags_none_in_value_match(mocker, config):
{
"action": RuleAction.NONE_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1588,7 +1588,7 @@ def test_flags_none_in_value_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Rubao"]},
context={"tenant_id": ["Mary"]},
default=False,
)

Expand All @@ -1607,7 +1607,7 @@ def test_flags_none_in_value_no_match(mocker, config):
{
"action": RuleAction.NONE_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand All @@ -1618,7 +1618,7 @@ def test_flags_none_in_value_no_match(mocker, config):
feature_flags = init_feature_flags(mocker, mocked_app_config_schema, config)
toggle = feature_flags.evaluate(
name="my_feature",
context={"tenant_id": ["Heitor"]},
context={"tenant_id": ["Pat"]},
default=False,
)

Expand Down Expand Up @@ -1646,7 +1646,7 @@ def test_intersection_non_list_value(mocker, config, intersection_action):
{
"action": intersection_action,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand Down Expand Up @@ -1680,7 +1680,7 @@ def test_exception_handler(mocker, config):
{
"action": RuleAction.ANY_IN_VALUE.value,
"key": "tenant_id",
"value": ["Łukasz", "Gerald", "Leandro", "Heitor"],
"value": ["Akua", "John", "Maria", "Pat"],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ def test_validate_all_in_value_condition_invalid_value():
# GIVEN a schema with a ANY_IN_VALUE action with non-list value
condition = {
CONDITION_ACTION: RuleAction.ALL_IN_VALUE.value,
CONDITION_VALUE: "Leandro",
CONDITION_VALUE: "Pat",
}

rule_name = "non-list value for ALL_IN_VALUE"
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/parser/_pydantic/test_vpc_lattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

def test_vpc_lattice_event_with_envelope():
raw_event = load_event("vpcLatticeEvent.json")
raw_event["body"] = '{"username": "Leandro", "name": "Damascena"}'
raw_event["body"] = '{"username": "Akua", "name": "Mansa"}'
parsed_event: MyVpcLatticeBusiness = parse(
event=raw_event,
model=MyVpcLatticeBusiness,
envelope=envelopes.VpcLatticeEnvelope,
)

assert parsed_event.username == "Leandro"
assert parsed_event.name == "Damascena"
assert parsed_event.username == "Akua"
assert parsed_event.name == "Mansa"


def test_vpc_lattice_event():
Expand Down