diff Tests/Tests.py @ 137:412d5f70447e

testing asynchronous c-move
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 24 May 2018 21:43:40 +0200
parents 5634ef96fcc5
children 0682740fcfcb
line wrap: on
line diff
--- a/Tests/Tests.py	Wed May 23 10:07:39 2018 +0200
+++ b/Tests/Tests.py	Thu May 24 21:43:40 2018 +0200
@@ -1123,11 +1123,21 @@
 
     def test_incoming_movescu(self):
         UploadInstance(_REMOTE, 'Multiframe.dcm')
-        
+
+        # No matching patient, so no job is created
+        self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
+        CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ])        
         self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
-        CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=none' ])
-        self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
+
+        # 1 Matching patient, track the job
+        a = set(DoGet(_REMOTE, '/jobs'))
         CallMoveScu([ '--patient', '-k', '0008,0052=PATIENT', '-k', 'PatientID=12345678' ])
+        b = set(DoGet(_REMOTE, '/jobs'))
+        
+        diff = list(b - a)
+        self.assertEqual(1, len(diff))
+        self.assertTrue(WaitJobDone(_REMOTE, diff[0]))
+
         self.assertEqual(1, len(DoGet(_LOCAL, '/patients')))
 
 
@@ -2617,12 +2627,22 @@
     def test_incoming_movescu_accession(self):
         UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0001.dcm')
         
+        # No matching patient, so no job is created
         self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
         CallMoveScu([ '--study', '-k', '0008,0052=STUDY', '-k', 'AccessionNumber=nope' ])
         self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
         CallMoveScu([ '--study', '-k', '0008,0052=PATIENT', '-k', 'AccessionNumber=A10003245599' ])
         self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
+
+        # 1 Matching patient, track the job
+        a = set(DoGet(_REMOTE, '/jobs'))
         CallMoveScu([ '--study', '-k', '0008,0052=STUDY', '-k', 'AccessionNumber=A10003245599' ])
+        b = set(DoGet(_REMOTE, '/jobs'))
+        
+        diff = list(b - a)
+        self.assertEqual(1, len(diff))
+        self.assertTrue(WaitJobDone(_REMOTE, diff[0]))
+
         self.assertEqual(1, len(DoGet(_LOCAL, '/patients')))