diff Tests/Tests.py @ 334:971ff285302b

test_rest_modalities_in_study_2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 Sep 2020 16:04:48 +0200
parents 695be643b0f4
children 96718de2f29c
line wrap: on
line diff
--- a/Tests/Tests.py	Sat Sep 12 16:00:23 2020 +0200
+++ b/Tests/Tests.py	Tue Sep 15 16:04:48 2020 +0200
@@ -5985,3 +5985,30 @@
         raw = DoGet(_REMOTE, '/instances/%s/frames/0/raw' % b)
         self.assertEqual(512 * 512 * 2, len(raw))
         
+
+    def test_rest_modalities_in_study_2(self):
+        # Problem reported by Alain Mazy on 2020-09-15
+        UploadInstance(_REMOTE, 'Comunix/Ct/IM-0001-0001.dcm')
+        UploadInstance(_REMOTE, 'Comunix/Pet/IM-0001-0001.dcm')
+
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Study',
+                                             'Query' : { 'ModalitiesInStudy' : 'UX' }})
+        self.assertEqual(0, len(a))
+
+        for i in [ '', 'PT', 'CT\\PT', 'UX\\PT', 'CT\\PT' ]:
+            # The empty string '' corresponds to universal matching
+            a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Study',
+                                                 'Query' : { 'ModalitiesInStudy' : i }})
+            self.assertEqual(1, len(a))
+
+            i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0020,000d=', '-k', '0008,0061=%s' % i ])
+            studyInstanceUid = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+            self.assertEqual(1, len(studyInstanceUid))
+            
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Study',
+                                             'Query' : { 'ModalitiesInStudy' : 'CT' }})
+        self.assertEqual(1, len(a))  # Fails in Orthanc <= 1.7.3
+
+        i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0020,000d=', '-k', '0008,0061=CT' ])
+        studyInstanceUid = re.findall('\(0020,000d\).*?\[(.*?)\]', i)
+        self.assertEqual(1, len(studyInstanceUid))  # Fails in Orthanc <= 1.7.3