diff Plugins/DicomWeb/Run.py @ 33:eb6d219af210

test stow
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 02 Aug 2015 14:01:32 +0200
parents 682c4e2a1162
children 97acfdf0dbce
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Sun Aug 02 13:14:58 2015 +0200
+++ b/Plugins/DicomWeb/Run.py	Sun Aug 02 14:01:32 2015 +0200
@@ -19,9 +19,11 @@
 
 
 import os
+import pprint
 import sys
 import argparse
 import unittest
+from DicomWeb import *
 
 sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'Tests'))
 from Toolbox import *
@@ -49,7 +51,7 @@
 parser.add_argument('--wado',
                     default = '/wado',
                     help = 'Path to the WADO API')
-parser.add_argument('--dicom-web',
+parser.add_argument('--dicomweb',
                     default = '/dicom-web/',
                     help = 'Path to the DICOMweb API')
 parser.add_argument('--force', help = 'Do not warn the user',
@@ -140,6 +142,24 @@
         self.assertEqual(512, im.size[0])
         self.assertEqual(358, im.size[1])
 
+    def test_stow(self):
+        self.assertEqual(0, len(DoGet(ORTHANC, '/instances')))
+        SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm'))
+        self.assertEqual(1, len(DoGet(ORTHANC, '/instances')))
+        a = SendStow(ORTHANC, args.dicomweb + '/studies', GetDatabasePath('Phenix/IM-0001-0001.dcm'))
+        self.assertEqual(1, len(DoGet(ORTHANC, '/instances')))
+
+        self.assertEqual(0, len(a['00081198']['Value']))  # No error
+        self.assertEqual(1, len(a['00081199']['Value']))  # 1 success
+
+        self.assertTrue(a['00081190']['Value'][0].endswith('studies/2.16.840.1.113669.632.20.1211.10000098591'))
+        self.assertTrue(a['00081199']['Value'][0]['00081190']['Value'][0].
+                        endswith('series/1.2.840.113704.1.111.5692.1127828999.2/instances/1.2.840.113704.7.1.1.6632.1127829031.2'))
+
+        b = GetMultipart(a['00081190']['Value'][0])
+        self.assertEqual(1, len(b))
+        self.assertEqual(368852, len(b[0]))
+
 
 
 try: