changeset 688:b58f639aee60

added tests for limit=0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Sep 2024 21:20:48 +0200
parents edf6ce075823
children 870fcd19560f
files Tests/Tests.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Sep 10 14:33:04 2024 +0200
+++ b/Tests/Tests.py	Wed Sep 11 21:20:48 2024 +0200
@@ -3007,8 +3007,16 @@
         self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/patients&since=10' % i))
         self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/patients&limit=10' % i))
 
-        if not IsOrthancVersionAbove(_REMOTE, 1, 12, 5):   # with ExtendedFind, the limit=0 means no-limit like in /tools/find
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 5):   # with ExtendedFind, the limit=0 means no-limit like in /tools/find
+            self.assertEqual(2, len(DoGet(_REMOTE, '/patients?since=0&limit=0')))
+            self.assertEqual(1, len(DoGet(_REMOTE, '/patients?since=1&limit=0')))
+            self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=2&limit=0')))
+            self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=3&limit=0')))
+        else:
             self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=0&limit=0')))
+            self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=1&limit=0')))
+            self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=2&limit=0')))
+            self.assertEqual(0, len(DoGet(_REMOTE, '/patients?since=3&limit=0')))
         self.assertEqual(2, len(DoGet(_REMOTE, '/patients?since=0&limit=100')))
         self.assertEqual(2, len(DoGet(_REMOTE, '/studies?since=0&limit=100')))
         self.assertEqual(4, len(DoGet(_REMOTE, '/series?since=0&limit=100')))