# HG changeset patch # User Sebastien Jodogne # Date 1589821667 -7200 # Node ID 6652d5720a45bbfa79742e66cd7f9a92340b6815 # Parent d6c2eb5a2603c73bb147d8f0251cadcdb991dea3 test_modify_keep_source diff -r d6c2eb5a2603 -r 6652d5720a45 Tests/Tests.py --- a/Tests/Tests.py Fri May 15 09:19:00 2020 +0200 +++ b/Tests/Tests.py Mon May 18 19:07:47 2020 +0200 @@ -5663,3 +5663,34 @@ self.assertEqual('1.2.840.10008.1.2.4.57', GetTransferSyntax(z.read('IMAGES/IM0'))) + def test_modify_keep_source(self): + # https://groups.google.com/d/msg/orthanc-users/CgU-Wg8vDio/BY5ZWcDEAgAJ + i = UploadInstance(_REMOTE, 'DummyCT.dcm') + self.assertEqual(1, len(DoGet(_REMOTE, '/studies'))) + + j = DoPost(_REMOTE, '/studies/%s/modify' % i['ParentStudy'], { + 'Replace' : { + 'StationName' : 'TEST', + }, + 'KeepSource' : True, + }) + + s = DoGet(_REMOTE, '/studies') + self.assertEqual(2, len(s)) + self.assertTrue(i['ParentStudy'] in s) + self.assertTrue(j['ID'] in s) + + DoDelete(_REMOTE, '/studies/%s' % j['ID']) + self.assertEqual(1, len(DoGet(_REMOTE, '/studies'))) + + j = DoPost(_REMOTE, '/studies/%s/modify' % i['ParentStudy'], { + 'Replace' : { + 'StationName' : 'TEST', + }, + 'KeepSource' : False, + }) + + s = DoGet(_REMOTE, '/studies') + self.assertEqual(1, len(s)) + self.assertFalse(i['ParentStudy'] in s) + self.assertTrue(j['ID'] in s)