changeset 273:afcd550a9216

test_multiple_mime_accept_wado_rs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Mar 2020 17:18:13 +0100
parents a94b0409fdac
children 6b522ef4c3ec
files Plugins/DicomWeb/Run.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Tue Mar 03 10:43:06 2020 +0100
+++ b/Plugins/DicomWeb/Run.py	Tue Mar 03 17:18:13 2020 +0100
@@ -1056,6 +1056,29 @@
         self.assertEqual(a, c)
 
 
+    def test_multiple_mime_accept_wado_rs(self):
+        # "Multiple MIME type Accept Headers for Wado-RS"
+        # https://groups.google.com/forum/#!msg/orthanc-users/P3B6J9abZpE/syn5dnW2AwAJ
+
+        UploadInstance(ORTHANC, 'DummyCT.dcm')
+        study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390'
+
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study)))
+        
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study,
+                                      headers = { 'Accept' : 'application/json, application/dicom+json' })))
+        
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study,
+                                      headers = { 'Accept' : 'toto, application/dicom+json' })))
+        
+        self.assertEqual(1, len(DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study,
+                                      headers = { 'Accept' : 'application/json, tata' })))
+        
+        self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study,
+                                                   headers = { 'Accept' : 'toto, tata' }))
+        
+        
+        
 try:
     print('\nStarting the tests...')
     unittest.main(argv = [ sys.argv[0] ] + args.options)