# HG changeset patch # User Alain Mazy # Date 1687615691 -7200 # Node ID 71096a3e30063bafe6b78db6bec824e0a8975fbc # Parent c8d2775f0d0219385f00ca70c4de0114f46a57ac test orthanc version diff -r c8d2775f0d02 -r 71096a3e3006 Plugins/DicomWeb/Run.py --- a/Plugins/DicomWeb/Run.py Fri Jun 23 19:17:03 2023 +0200 +++ b/Plugins/DicomWeb/Run.py Sat Jun 24 16:08:11 2023 +0200 @@ -1692,35 +1692,36 @@ def test_issue_216(self): - study = UploadInstance(ORTHANC, 'ColorTestImageJ.dcm')['ParentStudy'] - studyUid = DoGet(ORTHANC, '/studies/%s' % study)['MainDicomTags']['StudyInstanceUID'] + if IsOrthancVersionAbove(ORTHANC, 1, 12, 1): + 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]) + 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]) - # 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]) + 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=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]) + # 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: