Skip to content

Commit

Permalink
Last few review changes, I hope!
Browse files Browse the repository at this point in the history
  • Loading branch information
FifthPotato committed Jan 31, 2024
1 parent ff488a8 commit 9fbb96f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_guard_atomic_operations_admin_only__issue_38(self):

def test_guard_atomic_operations_editor_list__issue_38(self):
# set metadata_guard config AVU on collection to admin_only: false and irods:: as protected prefix
# also, add test user as editor
# also, add alice user as editor
with iRODSSession(host='localhost', port=1247, user='rods', password='rods', zone='tempZone') as local_admin:
coll = local_admin.collections.get("/tempZone")
METADATA_GUARD_CONFIG = {
Expand All @@ -124,7 +124,7 @@ def test_guard_atomic_operations_editor_list__issue_38(self):
obj.metadata.apply_atomic_operations( AVUOperation(operation='add', avu=iRODSMeta('irods::editorlist', 'editorlist')))
self.assertEqual(obj.metadata['irods::editorlist'], iRODSMeta('irods::editorlist', 'editorlist'))

# remove test user from editor list
# remove alice user from editor list
with iRODSSession(host='localhost', port=1247, user='rods', password='rods', zone='tempZone') as local_admin:
coll = local_admin.collections.get("/tempZone")
METADATA_GUARD_CONFIG = {
Expand All @@ -137,7 +137,9 @@ def test_guard_atomic_operations_editor_list__issue_38(self):
with iRODSSession(host='localhost', port=1247, user='alice', password='test', zone='tempZone') as unprivileged_user:
obj = unprivileged_user.data_objects.get(self.TEST_DATA_OBJECT_PATH)

# operation should succeed, as alice is set as an editor
# this was set previously, make sure it is still the case
self.assertEqual(obj.metadata['irods::editorlist'], iRODSMeta('irods::editorlist', 'editorlist'))
# operation should fail, as test user is no longer in editor list
self.assertRaises(irods.exception.CAT_INSUFFICIENT_PRIVILEGE_LEVEL, lambda: obj.metadata.apply_atomic_operations( AVUOperation(operation='remove', avu=iRODSMeta('irods::editorlist', 'editorlist'))))


Expand Down

0 comments on commit 9fbb96f

Please sign in to comment.