From 88abe7fb1df2a409b04a41cec9bff94f0a7701a4 Mon Sep 17 00:00:00 2001 From: SamRemis Date: Thu, 21 Nov 2024 11:42:08 -0500 Subject: [PATCH] Update test_endpoint_provider.py --- tests/unit/test_endpoint_provider.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_endpoint_provider.py b/tests/unit/test_endpoint_provider.py index b6428e5179..8bc8c429d0 100644 --- a/tests/unit/test_endpoint_provider.py +++ b/tests/unit/test_endpoint_provider.py @@ -519,12 +519,24 @@ def test_aws_is_virtual_hostable_s3_bucket_allow_subdomains( ({"foo": ['bar']}, 'foo[1]', None), # Out of range index ({"foo": ['bar']}, 'foo[0]', "bar"), # Named index (("foo",), '[0]', "foo"), # Bare index - ({"foo": {'bar': []}}, 'foo.baz[0]', None), # Missing subindex - ({"foo": {'bar': []}}, 'foo.bar[0]', None), # Out of range subindex - ({"foo": {"bar": "baz"}}, 'foo.bar', "baz"), # Subindex with named index - ({"foo": {"bar": ["baz"]}}, 'foo.bar[0]', "baz"), # Subindex with numeric index + ({"foo": {}}, 'foo.bar[0]', None), # Missing index from split path + ( + {"foo": {'bar': []}}, + 'foo.bar[0]', + None, + ), # Out of range from split path + ( + {"foo": {"bar": "baz"}}, + 'foo.bar', + "baz", + ), # Split path with named index + ( + {"foo": {"bar": ["baz"]}}, + 'foo.bar[0]', + "baz", + ), # Split path with numeric index ], ) def test_get_attr(rule_lib, value, path, expected_value): result = rule_lib.get_attr(value, path) - assert result == expected_value \ No newline at end of file + assert result == expected_value