diff --git a/irods/test/meta_test.py b/irods/test/meta_test.py index f398a87a..7be4b1c4 100644 --- a/irods/test/meta_test.py +++ b/irods/test/meta_test.py @@ -1,6 +1,7 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- +import contextlib import os import re import sys @@ -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