changeset 54:c5f8a6b0d85e

test_incoming_movescu_accession
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Oct 2015 11:21:24 +0200
parents e0d1ee04119f
children a395fd51cc4f
files Tests/Tests.py
diffstat 1 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Oct 13 16:10:46 2015 +0200
+++ b/Tests/Tests.py	Tue Oct 20 11:21:24 2015 +0200
@@ -77,6 +77,15 @@
     return True
 
 
+def CallMoveScu(args):
+    subprocess.check_call([ FindExecutable('movescu'), 
+                            '--move', _LOCAL['DicomAet'],      # Target AET (i.e. storescp)
+                            '--call', _REMOTE['DicomAet'],     # Called AET (i.e. Orthanc)
+                            '--aetitle', _LOCAL['DicomAet'],   # Calling AET (i.e. storescp)
+                            _REMOTE['Server'], str(_REMOTE['DicomPort'])  ] + args,
+                          stderr=subprocess.PIPE)
+
+
 
 def GenerateTestSequence():
     return [
@@ -1038,14 +1047,6 @@
         
 
     def test_incoming_movescu(self):
-        def CallMoveScu(args):
-            subprocess.check_call([ FindExecutable('movescu'), 
-                                    '--move', _LOCAL['DicomAet'],      # Target AET (i.e. storescp)
-                                    '--call', _REMOTE['DicomAet'],     # Called AET (i.e. Orthanc)
-                                    '--aetitle', _LOCAL['DicomAet'],   # Calling AET (i.e. storescp)
-                                    _REMOTE['Server'], str(_REMOTE['DicomPort'])  ] + args,
-                                  stderr=subprocess.PIPE)
-
         UploadInstance(_REMOTE, 'Multiframe.dcm')
         
         self.assertEqual(0, len(DoGet(_LOCAL, '/patients')))
@@ -2452,3 +2453,16 @@
         self.assertEqual('/instances/%s/file' % j, o['Dicom'][1])
         self.assertEqual('/instances/%s/frames/0' % i, o['Slices'][0])
         self.assertEqual('/instances/%s/frames/0' % j, o['Slices'][1])
+
+
+    def test_incoming_movescu_accession(self):
+        UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0001.dcm')
+        
+        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')))
+        CallMoveScu([ '--study', '-k', '0008,0052=STUDY', '-k', 'AccessionNumber=A10003245599' ])
+        self.assertEqual(1, len(DoGet(_LOCAL, '/patients')))
+