diff Tests/Tests.py @ 530:937bee4a2fe3

fix
author Alain Mazy <am@osimis.io>
date Tue, 18 Apr 2023 17:14:01 +0200
parents 53cf0e3ad007
children 8a920ab91cf4
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Apr 18 15:37:01 2023 +0200
+++ b/Tests/Tests.py	Tue Apr 18 17:14:01 2023 +0200
@@ -598,24 +598,18 @@
         countInstances = 0
         completed = 0
         while True:
-            c = DoGet(_REMOTE, '/changes', { 'since' : since, 'limit' : 3 })
+            c = DoGet(_REMOTE, '/changes', { 'since' : since, 'limit' : 1000 })
             since = c['Last']
             for i in c['Changes']:
-                if i['ResourceType'] == 'Instance':
+                # We have set StableAge to 1 -> we might have StabeStudy but this is not sure -> detect only the 'New' events
+
+                if i['ResourceType'] == 'Instance' and i['ChangeType'] == 'NewInstance':
                     countInstances += 1
-                if i['ResourceType'] == 'Patient':
+                if i['ResourceType'] == 'Patient' and i['ChangeType'] == 'NewPatient':
                     countPatients += 1
-                if i['ResourceType'] == 'Study':
+                if i['ResourceType'] == 'Study' and i['ChangeType'] == 'NewStudy':
                     countStudies += 1
-                if i['ResourceType'] == 'Series':
-                    countSeries += 1
-                if i['ChangeType'] == 'NewInstance':
-                    countInstances += 1
-                if i['ChangeType'] == 'NewPatient':
-                    countPatients += 1
-                if i['ChangeType'] == 'NewStudy':
-                    countStudies += 1
-                if i['ChangeType'] == 'NewSeries':
+                if i['ResourceType'] == 'Series' and i['ChangeType'] == 'NewSeries':
                     countSeries += 1
                 if i['ChangeType'] == 'CompletedSeries':
                     completed += 1
@@ -624,11 +618,11 @@
                 self.assertTrue('Seq' in i)
             if c['Done']:
                 break
-
-        self.assertEqual(2 * 50, countInstances)
-        self.assertEqual(2 * 1, countPatients)
-        self.assertEqual(2 * 1, countStudies)
-        self.assertEqual(2 * 2, countSeries)
+        # we count only the events since before the upload of 2 Knee series !
+        self.assertEqual(50, countInstances)
+        self.assertEqual(1, countPatients)
+        self.assertEqual(1, countStudies)
+        self.assertEqual(2, countSeries)
         self.assertEqual(0, completed)