changeset 750:27a955d3d05f

fix tests version
author Alain Mazy <am@orthanc.team>
date Fri, 06 Dec 2024 08:57:06 +0100
parents 09d3e251b783
children 4a97afe7d8bc
files Tests/Tests.py
diffstat 1 files changed, 48 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Wed Dec 04 18:14:01 2024 +0100
+++ b/Tests/Tests.py	Fri Dec 06 08:57:06 2024 +0100
@@ -10839,50 +10839,51 @@
             self.assertEqual('application/octet-stream', resp['content-type'])
             self.assertEqual('bytes 0-131/2472', resp['content-range'])
 
-        i = UploadInstance(_REMOTE, 'DummyCT.dcm') ['ID']
-
-        DoPost(_REMOTE, '/instances/%s/attachments/dicom/uncompress' % i)
-        TestData('data')
-        TestData('compressed-data')
-
-        DoPost(_REMOTE, '/instances/%s/attachments/dicom/compress' % i)
-        TestData('data')
-
-        (resp, compressed) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i)
-        self.assertFalse('content-range' in resp)
-        self.assertEqual(200, resp.status)
-        self.assertTrue(len(compressed) < 2000)
-        self.assertEqual(len(compressed), int(resp['content-length']))
-        self.assertEqual('application/octet-stream', resp['content-type'])
-
-        (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=-' })
-        self.assertTrue('content-range' in resp)
-        self.assertEqual(206, resp.status)
-        self.assertEqual(compressed, content)
-        self.assertEqual(len(compressed), int(resp['content-length']))
-        self.assertEqual('application/octet-stream', resp['content-type'])
-        self.assertEqual('bytes 0-%d/%d' % (len(compressed) - 1, len(compressed)), resp['content-range'])
-
-        (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=10-' })
-        self.assertTrue('content-range' in resp)
-        self.assertEqual(206, resp.status)
-        self.assertEqual(compressed[10:], content)
-        self.assertEqual(len(compressed) - 10, int(resp['content-length']))
-        self.assertEqual('application/octet-stream', resp['content-type'])
-        self.assertEqual('bytes 10-%d/%d' % (len(compressed) - 1, len(compressed)), resp['content-range'])
-
-        (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=-20' })
-        self.assertTrue('content-range' in resp)
-        self.assertEqual(206, resp.status)
-        self.assertEqual(compressed[0:21], content)
-        self.assertEqual(21, int(resp['content-length']))
-        self.assertEqual('application/octet-stream', resp['content-type'])
-        self.assertEqual('bytes 0-20/%d' % len(compressed), resp['content-range'])
-
-        (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=10-20' })
-        self.assertTrue('content-range' in resp)
-        self.assertEqual(206, resp.status)
-        self.assertEqual(compressed[10:21], content)
-        self.assertEqual(11, int(resp['content-length']))
-        self.assertEqual('application/octet-stream', resp['content-type'])
-        self.assertEqual('bytes 10-20/%d' % len(compressed), resp['content-range'])
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 5):
+            i = UploadInstance(_REMOTE, 'DummyCT.dcm') ['ID']
+
+            DoPost(_REMOTE, '/instances/%s/attachments/dicom/uncompress' % i)
+            TestData('data')
+            TestData('compressed-data')
+
+            DoPost(_REMOTE, '/instances/%s/attachments/dicom/compress' % i)
+            TestData('data')
+
+            (resp, compressed) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i)
+            self.assertFalse('content-range' in resp)
+            self.assertEqual(200, resp.status)
+            self.assertTrue(len(compressed) < 2000)
+            self.assertEqual(len(compressed), int(resp['content-length']))
+            self.assertEqual('application/octet-stream', resp['content-type'])
+
+            (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=-' })
+            self.assertTrue('content-range' in resp)
+            self.assertEqual(206, resp.status)
+            self.assertEqual(compressed, content)
+            self.assertEqual(len(compressed), int(resp['content-length']))
+            self.assertEqual('application/octet-stream', resp['content-type'])
+            self.assertEqual('bytes 0-%d/%d' % (len(compressed) - 1, len(compressed)), resp['content-range'])
+
+            (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=10-' })
+            self.assertTrue('content-range' in resp)
+            self.assertEqual(206, resp.status)
+            self.assertEqual(compressed[10:], content)
+            self.assertEqual(len(compressed) - 10, int(resp['content-length']))
+            self.assertEqual('application/octet-stream', resp['content-type'])
+            self.assertEqual('bytes 10-%d/%d' % (len(compressed) - 1, len(compressed)), resp['content-range'])
+
+            (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=-20' })
+            self.assertTrue('content-range' in resp)
+            self.assertEqual(206, resp.status)
+            self.assertEqual(compressed[0:21], content)
+            self.assertEqual(21, int(resp['content-length']))
+            self.assertEqual('application/octet-stream', resp['content-type'])
+            self.assertEqual('bytes 0-20/%d' % len(compressed), resp['content-range'])
+
+            (resp, content) = DoGetRaw(_REMOTE, '/instances/%s/attachments/dicom/compressed-data' % i, headers = { 'Range' : 'bytes=10-20' })
+            self.assertTrue('content-range' in resp)
+            self.assertEqual(206, resp.status)
+            self.assertEqual(compressed[10:21], content)
+            self.assertEqual(11, int(resp['content-length']))
+            self.assertEqual('application/octet-stream', resp['content-type'])
+            self.assertEqual('bytes 10-20/%d' % len(compressed), resp['content-range'])