changeset 181:911070f790e3

more checks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Oct 2018 17:16:11 +0200
parents fcb0c14dadb8
children 7a6b532853ab
files Tests/Tests.py Tests/Toolbox.py
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Fri Oct 05 16:07:10 2018 +0200
+++ b/Tests/Tests.py	Mon Oct 08 17:16:11 2018 +0200
@@ -3866,7 +3866,8 @@
                               'Series' : [ t2 ],
                               'Replace' : { 'PatientName' : 'Hello' },
                               'Remove' : [ 'ReferringPhysicianName' ],
-                              'KeepSource' : False
+                              'KeepSource' : False,
+                              'Asynchronous' : True
                           }))
 
         self.assertNotEqual(None, job)
@@ -3901,7 +3902,8 @@
         job = MonitorJob2(_REMOTE, lambda: DoPost
                           (_REMOTE, '/studies/%s/merge' % knee, {
                               'Resources' : [ brainix ],
-                              'KeepSource' : True
+                              'KeepSource' : True,
+                              'Synchronous' : False
                           }))
 
         self.assertNotEqual(None, job)
--- a/Tests/Toolbox.py	Fri Oct 05 16:07:10 2018 +0200
+++ b/Tests/Toolbox.py	Mon Oct 08 17:16:11 2018 +0200
@@ -249,13 +249,17 @@
 
 def MonitorJob2(orthanc, func):  # "func" is a lambda
     a = set(DoGet(orthanc, '/jobs'))
-    func()
+    job = func()
     b = set(DoGet(orthanc, '/jobs'))
         
     diff = list(b - a)
     if len(diff) != 1:
         print('No job was created!')
         return None
+    elif (not 'ID' in job or
+          diff[0] != job['ID']):
+        print('Mismatch in the job ID')
+        return None
     elif WaitJobDone(orthanc, diff[0]):
         return diff[0]
     else: