Skip to content

Commit f2d11e9

Browse files
committed
[_606] update get_json_encoded_struct
1 parent 967ac12 commit f2d11e9

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

irods/message/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,13 @@ def __init__(self, msg_type=b'', msg=None, error=b'', bs=b'', int_info=0):
285285
self.int_info = int_info
286286

287287
def get_json_encoded_struct (self):
288+
288289
Xml = ET().fromstring(self.msg.replace(b'\0',b''))
290+
291+
STR_PI_element = Xml.find('myStr')
292+
if STR_PI_element is not None:
293+
return json.loads( STR_PI_element.text )
294+
289295
json_str = Xml.find('buf').text
290296
if Xml.tag == 'BinBytesBuf_PI':
291297
mybin = JSON_Binary_Response()

irods/test/meta_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,16 @@ def tearDown(self):
120120
helpers.remove_unused_metadata(self.sess)
121121
self.sess.cleanup()
122122

123-
from irods.test.helpers import create_simple_resc_hierarchy
123+
from irods.test.helpers import (create_simple_resc, create_simple_resc_hierarchy)
124+
125+
def test_replica_truncate_json_error__issue_606(self):
126+
path = self.coll_path + "/atomic_meta_issue_606"
127+
obj = self.sess.data_objects.create(path)
128+
with self.create_simple_resc('repl_trunc_test_resc__issue_606') as f:
129+
try:
130+
obj.replica_truncate(1,**{kw.RESC_NAME_KW:f})
131+
except ex.iRODSException as e:
132+
resp = e.server_msg.get_json_encoded_struct()
124133

125134
def test_atomic_metadata_json_error__issue_606(self):
126135
path = self.coll_path + "/atomic_meta_issue_606"

0 commit comments

Comments
 (0)