Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre committed Oct 9, 2024
1 parent a0a9e96 commit 572189a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/tests/arborist/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ async def test_can_user_access_resources(
{"service": "service2", "method": "read"},
{"service": "service1", "method": "write"},
],
"/d": [
{"service": "service1", "method": "write"},
{"service": "service1", "method": "read"},
],
},
)
}
Expand All @@ -258,12 +262,13 @@ async def test_can_user_access_resources(
username="test-user",
service="service1",
method="read",
resource_paths=["/a", "/a/b", "/c"],
resource_paths=["/a", "/a/b", "/c", "/d"],
)
if use_async:
res = await res

# /a: right service and method => True
# /a/b: nested under /a which is accessible => True
# /c: right service, wrong method and right method, wrong service => False
assert res == {"/a": True, "/a/b": True, "/c": False}
# /d: one of the permissions is the right service and method => True
assert res == {"/a": True, "/a/b": True, "/c": False, "/d": True}

0 comments on commit 572189a

Please sign in to comment.