Skip to content

Commit

Permalink
[_582] check that xml_mode solves issue of nonprintables in metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
d-w-moore committed Nov 13, 2024
1 parent 5ae9590 commit 4a2e7d8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions irods/test/meta_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import contextlib
import os
import re
import sys
Expand Down Expand Up @@ -646,6 +647,27 @@ def test_thoroughgoing_correctness_of_genquery_result_column_mappings__issue_642
finally:
del test_coll.metadata[meta_key]

def test_xml_mode_addresses_odd_metadata_characters__issue_582(self):
session = self.sess
try:
hexvalue = "53:6b:6f:70:65:43:61:6c:58:c3:af:c2:bf:c2:bd:c3:af:c2:bf:c2:bd:23:01:32:64:31"
hex_list = [int(byte, 16) for byte in hexvalue.split(":")]
string_value = "".join([chr(byte) for byte in hex_list])

try:
from irods.helpers import xml_mode
except ImportError:
# Create an xml_mode context manager that is a no-op.
def _dummy(*x): yield
xml_mode = contextlib.contextmanager(_dummy)

with xml_mode('QUASI_XML'):
obj = session.collections.get('/tempZone/home/rods')
attr_str = "awesome"
value_str = string_value
obj.metadata.add( attr_str, value_str )
finally:
del obj.metadata[attr_str]

if __name__ == '__main__':
# let the tests find the parent irods lib
Expand Down

0 comments on commit 4a2e7d8

Please sign in to comment.