changeset 551:c8d2775f0d02

added test_issue_216 for DICOMweb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Jun 2023 19:17:03 +0200
parents a8f6e641e087
children 71096a3e3006
files Plugins/DicomWeb/Run.py
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Fri Jun 23 19:09:48 2023 +0200
+++ b/Plugins/DicomWeb/Run.py	Fri Jun 23 19:17:03 2023 +0200
@@ -1691,6 +1691,38 @@
             self.assertIn("https://my-domain/dicom-web", m[0][u'7FE00010']['BulkDataURI'])
 
 
+    def test_issue_216(self):
+        study = UploadInstance(ORTHANC, 'ColorTestImageJ.dcm')['ParentStudy']
+        studyUid = DoGet(ORTHANC, '/studies/%s' % study)['MainDicomTags']['StudyInstanceUID']
+
+        m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyUid, headers = {
+            'accept': 'image/webp, */*;q=0.8, text/html, application/xhtml+xml, application/xml;q=0.9'
+        })
+        self.assertEqual(1, len(m))
+        self.assertEqual(studyUid, m[0]['0020000D']['Value'][0])
+
+        m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyUid, headers = {
+            'accept': 'text/html, application/xhtml+xml, application/xml, image/webp, */*;q=0.8'
+        })
+        self.assertEqual(1, len(m))
+        self.assertEqual(studyUid, m[0]['0020000D']['Value'][0])
+
+        # This fails on Orthanc <= 1.12.0 because of the "; q=.2"
+        # https://bugs.orthanc-server.com/show_bug.cgi?id=216
+        m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyUid, headers = {
+            'accept': 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2'
+        })
+        self.assertEqual(1, len(m))
+        self.assertEqual(studyUid, m[0]['0020000D']['Value'][0])
+
+        # This fails on Orthanc <= 1.12.0 because of the ";q=0.9"
+        m = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % studyUid, headers = {
+            'accept': 'text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8'
+        })
+        self.assertEqual(1, len(m))
+        self.assertEqual(studyUid, m[0]['0020000D']['Value'][0])
+
+
 try:
     print('\nStarting the tests...')
     unittest.main(argv = [ sys.argv[0] ] + args.options)