diff Tests/Toolbox.py @ 179:8a2dd77d4035

testing split/merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Oct 2018 17:54:32 +0200
parents d468cbe1b161
children 911070f790e3
line wrap: on
line diff
--- a/Tests/Toolbox.py	Thu Sep 20 14:22:38 2018 +0200
+++ b/Tests/Toolbox.py	Mon Oct 01 17:54:32 2018 +0200
@@ -247,6 +247,21 @@
     else:
         return WaitJobDone(orthanc, diff[0])
 
+def MonitorJob2(orthanc, func):  # "func" is a lambda
+    a = set(DoGet(orthanc, '/jobs'))
+    func()
+    b = set(DoGet(orthanc, '/jobs'))
+        
+    diff = list(b - a)
+    if len(diff) != 1:
+        print('No job was created!')
+        return None
+    elif WaitJobDone(orthanc, diff[0]):
+        return diff[0]
+    else:
+        print('Error while executing the job')
+        return None
+
 def GetDockerHostAddress():
     route = subprocess.check_output([ '/sbin/ip', 'route' ])
     m = re.search(r'default via ([0-9.]+)', route)