diff Plugins/DicomWeb/Run.py @ 131:90e5331ddee9

application/dicom+json is now the default in DICOMweb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jan 2018 16:37:21 +0100
parents 50cd127e5330
children e244312964d6
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Tue Jan 02 09:58:29 2018 +0100
+++ b/Plugins/DicomWeb/Run.py	Thu Jan 11 16:37:21 2018 +0100
@@ -202,16 +202,34 @@
         self.assertTrue('get' in sample)
 
         # application/dicom+xml
-        self.assertEqual(2, len(re.findall('^--', DoGet(ORTHANC, '/dicom-web/studies'), re.MULTILINE)))
-        self.assertEqual(2, len(re.findall('^--', DoPost(ORTHANC, '/dicom-web/servers/sample/get',
-                                                         { 'Uri' : '/studies' }), re.MULTILINE)))
+        self.assertEqual(2, len(re.findall('^--', DoGet(ORTHANC, '/dicom-web/studies',
+                                                        headers = { 'Accept' : 'application/dicom+xml' }),
+                                           re.MULTILINE)))
+        self.assertEqual(2, len(re.findall('^--', DoPost
+                                           (ORTHANC, '/dicom-web/servers/sample/get',
+                                            { 'Uri' : '/studies',
+                                              'HttpHeaders' : { 'Accept' : 'application/dicom+xml' }
+                                            }), re.MULTILINE)))
 
         # application/dicom+json
-        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies', headers = { 'Accept' : 'application/json' })))
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies',
+                                      headers = { 'Accept' : 'application/dicom+json' })))
+        self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get',
+                                       { 'Uri' : '/studies',
+                                         'HttpHeaders' : { 'Accept' : 'application/dicom+json' }})))
+
+        # application/json
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies',
+                                      headers = { 'Accept' : 'application/json' })))
         self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get',
                                        { 'Uri' : '/studies',
                                          'HttpHeaders' : { 'Accept' : 'application/json' }})))
 
+        # application/dicom+json is the default as of OrthancDicomWeb-0.5
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies')))
+        self.assertEqual(1, len(DoPost(ORTHANC, '/dicom-web/servers/sample/get',
+                                       { 'Uri' : '/studies' })))
+
 
     def test_server_stow(self):
         UploadInstance(ORTHANC, 'Knee/T1/IM-0001-0001.dcm')