Skip to content
Snippets Groups Projects
Commit 27ead26a authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

ENH: Add test for container updates of entity ACLs

parent 31fa2ba1
Branches
No related tags found
1 merge request!77Revert "WIP: pipeline"
Pipeline #50470 passed
......@@ -1353,6 +1353,10 @@ def test_select_query_with_invisible_reference():
def test_update_acl_with_unique():
"""Test that ACL can be updated despite name duplications with
``unique=False``.
"""
rt = db.RecordType(name="TestType").insert()
# Name duplicate
......@@ -1380,3 +1384,27 @@ def test_update_acl_with_unique():
rec = db.Record(id=rec1.id).retrieve()
assert rec.name == rec1.name
assert rec.name == rec2.name
def test_container_update_unique():
"""Test that ACL updates are performed correctly within a Container."""
# Both are visible to test at first
rt = db.RecordType(name="TestType").insert()
rec1 = db.Record(name="TestRec").add_parent(rt).insert()
rec2 = db.Record(name="TestRec").add_parent(rt).insert(unique=False)
switch_to_test_user()
ents = db.execute_query("FIND ENTITY TestType")
assert len(ents) == 3
switch_to_admin_user()
cont = db.Container().extend([rt, rec1, rec2])
cont.retrieve(flags={"ACL": None})
for ent in cont:
ent.deny(username=test_user, priority=False, permission="RETRIEVE:*")
cont.update(unique=False)
switch_to_test_user()
ents = db.execute_query("FIND ENTITY TestType")
assert len(ents) == 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment