changeset 301:6652d5720a45

test_modify_keep_source
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 18 May 2020 19:07:47 +0200
parents d6c2eb5a2603
children 22b6dd0f8c84
files Tests/Tests.py
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)