Skip to content

Commit

Permalink
[#576] test admin mode in metadata.apply_atomic_operations
Browse files Browse the repository at this point in the history
  • Loading branch information
d-w-moore authored and alanking committed Jul 3, 2024
1 parent 519ce4e commit e061922
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions irods/test/meta_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,35 @@ def test_metadata_manipulations_with_admin_kw__364__365(self):
if d: d.unlink(force=True)
if user: user.remove()

def test_atomic_metadata_operations_with_admin_kw__issue_576(self):
ses = data = user = None
adm = self.sess

if adm.server_version <= (4,2,11):
self.skipTest('ADMIN_KW not valid for Metadata API in iRODS 4.2.11 and previous')

try:
# Create a rodsuser
user = adm.users.create('bobby', 'rodsuser')
user.modify('password', 'bpass')

# Log in as rodsuser and create a data object owned by that user.
ses = iRODSSession(port = adm.port, zone = adm.zone, host = adm.host, user = user.name, password = 'bpass')
home = helpers.home_collection(ses)
data = ses.data_objects.create('{home}/issue_576'.format(**locals()))

# Do and test the results of the atomic set using the admin session, with the ADMIN_KW turned on.
data_via_admin = adm.data_objects.get(data.path)
avu_item = iRODSMeta('issue_576', 'dummy_value')
data_via_admin.metadata(admin=True).apply_atomic_operations(AVUOperation(operation = "add", avu = avu_item))
self.assertIn(avu_item, data_via_admin.metadata.items())
finally:
# Clean up objects after use.
if ses:
if ses.data_objects.exists(data.path):
ses.data_objects.unlink(data.path, force = True)
ses.cleanup()
if user: user.remove()

def test_add_coll_meta(self):
# add metadata to test collection
Expand Down

0 comments on commit e061922

Please sign in to comment.