diff Tests/Tests.py @ 698:7282c2df963d

tests for new DICOMWeb JSON DS handling
author Alain Mazy <am@orthanc.team>
date Wed, 25 Sep 2024 19:37:06 +0200
parents b2c3ba1adf55
children
line wrap: on
line diff
--- a/Tests/Tests.py	Mon Sep 23 15:40:57 2024 +0200
+++ b/Tests/Tests.py	Wed Sep 25 19:37:06 2024 +0200
@@ -5485,18 +5485,19 @@
             
 
     def test_dicomweb(self):
-        def Compare(dicom, reference):
-            a = UploadInstance(_REMOTE, dicom) ['ID']
-            b = DoGet(_REMOTE, '/instances/%s/file' % a,
-                      headers = { 'Accept' : 'application/dicom+json' })
-            with open(GetDatabasePath(reference), 'rb') as c:
-                d = json.load(c)
-                AssertAlmostEqualRecursive(self, d, b)
-                    
-        Compare('DummyCT.dcm', 'DummyCT.json')
-        Compare('MarekLatin2.dcm', 'MarekLatin2.json')
-        Compare('HierarchicalAnonymization/StructuredReports/IM0',
-                'HierarchicalAnonymization/StructuredReports/IM0.json')
+        if IsOrthancVersionAbove(_LOCAL, 1, 12, 5) and DoGet(_REMOTE, '/system')['ApiVersion'] >= 26:  # the references have changed with 1.12.5 -> we don't want to keep 2 references
+            def Compare(dicom, reference):
+                a = UploadInstance(_REMOTE, dicom) ['ID']
+                b = DoGet(_REMOTE, '/instances/%s/file' % a,
+                        headers = { 'Accept' : 'application/dicom+json' })
+                with open(GetDatabasePath(reference), 'rb') as c:
+                    d = json.load(c)
+                    AssertAlmostEqualRecursive(self, d, b)
+                        
+            Compare('DummyCT.dcm', 'DummyCT.json')
+            Compare('MarekLatin2.dcm', 'MarekLatin2.json')
+            Compare('HierarchicalAnonymization/StructuredReports/IM0',
+                    'HierarchicalAnonymization/StructuredReports/IM0.json')
 
 
     def test_issue_95_encodings(self):