changeset 874:54427d4f4a01 default tip

tests for LimitFindResults
author Alain Mazy <am@orthanc.team>
date Fri, 19 Dec 2025 12:39:32 +0100
parents c41709fd48e3
children
files Tests/Tests.py
diffstat 1 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Fri Dec 19 12:01:07 2025 +0100
+++ b/Tests/Tests.py	Fri Dec 19 12:39:32 2025 +0100
@@ -11945,7 +11945,7 @@
                                                             }
                                                     ]})
 
-            pprint.pprint(a)
+            # pprint.pprint(a)
         #     # print(len(a))
         #     # TODO: we should have something in the response that notifies us that the response is not "complete"
         #     # TODO: we should receive an error if we try to use "since" in this kind of search ?
@@ -11990,6 +11990,35 @@
             self.assertEqual('20061201', a[1]['MainDicomTags']['StudyDate'])
             self.assertEqual('20070101', a[2]['MainDicomTags']['StudyDate'])
 
+        # check LimitFindResults applies to both findscu and /tools/find
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 11):
+
+            allSeries = DoPost(_REMOTE, '/tools/find', {    
+                                            'Level' : 'Series',
+                                            'Query' : { 
+                                                'PatientName' : ''
+                                            },
+                                            'Expand': False
+                                            })
+            self.assertEqual(10, len(allSeries)) # because LimitFindResults is 10
+
+            i = CallFindScu([ '-k', 'QueryRetrieveLevel=Series', '-k', '0010,0010' ])
+            patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
+            self.assertEqual(10, len(patientNames)) # because LimitFindResults is 10
+
+            allInstances = DoPost(_REMOTE, '/tools/find', {    
+                                            'Level' : 'Instance',
+                                            'Query' : { 
+                                                'PatientName' : ''
+                                            },
+                                            'Expand': False
+                                            })
+            self.assertEqual(20, len(allInstances)) # because LimitFindInstances is 20
+
+            i = CallFindScu([ '-k', 'QueryRetrieveLevel=Instance', '-k', '0010,0010' ])
+            patientNames = re.findall(r'\(0010,0010\).*?\[(.*?)\]', i)
+            self.assertEqual(20, len(patientNames)) # because LimitFindResults is 20
+
 
     def test_attachment_range(self):
         def TestData(path):