changeset 723:5085b83b8eec find-refactoring tip

count-resources
author Alain Mazy <am@orthanc.team>
date Tue, 15 Oct 2024 15:53:00 +0200
parents 6cdba3322ef0
children
files Tests/Tests.py
diffstat 1 files changed, 25 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Mon Oct 14 17:21:47 2024 +0200
+++ b/Tests/Tests.py	Tue Oct 15 15:53:00 2024 +0200
@@ -11098,6 +11098,16 @@
 
             self.assertEqual(6, len(a))
 
+            # same query in count-resources
+            a = DoPost(_REMOTE, '/tools/count-resources', { 'Level' : 'Instance',
+                                                 'Query' : { 
+                                                    'SeriesDescription' : 'T*'
+                                                },
+                                                'ParentPatient' : kneePatientId
+                                                })
+
+            self.assertEqual(6, a["Count"])
+
 
     def test_extended_find_filter_metadata(self):
         if IsOrthancVersionAbove(_REMOTE, 1, 12, 5) and HasExtendedFind(_REMOTE): # TODO: remove HasExtendedFind once find-refactoring branch has been merged
@@ -11119,18 +11129,25 @@
             DoPut(_REMOTE, '/series/%s/metadata/my-metadata' % brainixEpiSeriesId, 'brainixEpi')
 
             # filter on metadata
-            a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Series',
-                                                 'Query' : { 
-                                                    'SeriesDescription' : 'T*'
-                                                },
-                                                'MetadataQuery' : {
-                                                    'my-metadata': '*2*'
-                                                }
-                                                })
+            q = {
+                'Level' : 'Series',
+                'Query' : { 
+                    'SeriesDescription' : 'T*'
+                },
+                'MetadataQuery' : {
+                    'my-metadata': '*2*'
+                }
+            }
+            a = DoPost(_REMOTE, '/tools/find', q)
 
             self.assertEqual(1, len(a))
             self.assertEqual(kneeT2SeriesId, a[0])
 
+            a = DoPost(_REMOTE, '/tools/count-resources', q)
+            self.assertEqual(1, a["Count"])
+
+
+
     def test_extended_find_expand(self):
         if IsOrthancVersionAbove(_REMOTE, 1, 12, 5) and HasExtendedFind(_REMOTE): # TODO: remove HasExtendedFind once find-refactoring branch has been merged
             UploadInstance(_REMOTE, 'Knee/T2/IM-0001-0001.dcm')