changeset 335:96718de2f29c Orthanc-1.7.4

simplification and fix of test_incoming_findscu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Sep 2020 13:21:12 +0200
parents 971ff285302b
children c8c76810c5bd
files GenerateConfigurationForTests.py Tests/Tests.py
diffstat 2 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/GenerateConfigurationForTests.py	Tue Sep 15 16:04:48 2020 +0200
+++ b/GenerateConfigurationForTests.py	Wed Sep 16 13:21:12 2020 +0200
@@ -140,6 +140,7 @@
 config['SaveJobs'] = False
 config['ExecuteLuaEnabled'] = True
 config['HttpTimeout'] = 2
+config['SyncStorageArea'] = False  # For tests to run more quickly
 del config['KeepAlive']
 
 config['Dictionary'] = {
--- a/Tests/Tests.py	Tue Sep 15 16:04:48 2020 +0200
+++ b/Tests/Tests.py	Wed Sep 16 13:21:12 2020 +0200
@@ -1185,7 +1185,7 @@
         self.assertTrue('20070208' in series)
         self.assertTrue('19980312' in series)
         
-        i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,0021', '-k', 'ModalitiesInStudy=MR\\XA' ])
+        i = CallFindScu([ '-k', '0008,0052=SERIES', '-k', '0008,0021', '-k', 'Modality=MR\\XA' ])
         series = re.findall('\(0008,0021\).*?\[\s*(.*?)\s*\]', i)
         self.assertEqual(1, len(series))
         self.assertTrue('19980312' in series)
@@ -5991,24 +5991,24 @@
         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
+        i = CallFindScu([ '-k', '0008,0052=STUDY', '-k', '0020,000d=', '-k', '0008,0061=' ])
+        modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+        self.assertEqual(1, len(modalitiesInStudy))
+        self.assertEqual('CT\\PT ', modalitiesInStudy[0])
+        
+        for i in [ '', 'CT', 'PT', 'UX', 'UX\\MR', 'CT\\PT', 'UX\\PT', 'CT\\PT', 'UX\\CT\\PT' ]:
+            # The empty string '' corresponds to universal matching.
+            # The case where "i == 'CT'" failed in Orthanc <= 1.7.3.
+            
+            if i in [ 'UX', 'UX\\MR' ]:
+                expected = 0
+            else:
+                expected = 1
+
             a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Study',
                                                  'Query' : { 'ModalitiesInStudy' : i }})
-            self.assertEqual(1, len(a))
+            self.assertEqual(expected, 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
+            self.assertEqual(expected, len(studyInstanceUid))