diff Plugins/DicomWeb/DicomWeb.py @ 398:9528e2a03d3c

adapt DICOMweb tests following fix of issue #196 (STOW-RS: Should return 200 only when successfully stored all instances)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 May 2021 18:59:08 +0200
parents 79ce0f7a9714
children e769bcf2b94f
line wrap: on
line diff
--- a/Plugins/DicomWeb/DicomWeb.py	Mon Apr 26 15:22:59 2021 +0200
+++ b/Plugins/DicomWeb/DicomWeb.py	Wed May 05 18:59:08 2021 +0200
@@ -39,7 +39,7 @@
         body += bytearray('\r\n', 'ascii')
 
 
-def SendStow(orthanc, uri, dicom):
+def SendStowRaw(orthanc, uri, dicom):
     # We do not use Python's "email" package, as it uses LF (\n) for line
     # endings instead of CRLF (\r\n) for binary messages, as required by
     # RFC 1341
@@ -65,7 +65,17 @@
         'Accept' : 'application/json',
     }
 
-    return DoPost(orthanc, uri, body, headers = headers)
+    (response, content) = DoPostRaw(orthanc, uri, body, headers = headers)
+
+    return (response.status, DecodeJson(content))
+
+
+def SendStow(orthanc, uri, dicom):
+    (status, content) = SendStowRaw(orthanc, uri, dicom)
+    if not (status in [ 200 ]):
+        raise Exception('Bad status: %d' % status)
+    else:
+        return content
 
 
 def DoGetMultipart(orthanc, uri, headers = {}, returnHeaders = False):