# HG changeset patch # User Sebastien Jodogne # Date 1687540623 -7200 # Node ID c8d2775f0d0219385f00ca70c4de0114f46a57ac # Parent a8f6e641e08796d46fa62395807cfe0a34312e07 added test_issue_216 for DICOMweb diff -r a8f6e641e087 -r c8d2775f0d02 Plugins/DicomWeb/Run.py --- 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)