Skip to content

Commit

Permalink
Update test_endpoint_provider.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRemis committed Nov 21, 2024
1 parent 1188f33 commit 88abe7f
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/unit/test_endpoint_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
assert result == expected_value

0 comments on commit 88abe7f

Please sign in to comment.