changeset 681:297b16b6a358

fix
author Alain Mazy <am@orthanc.team>
date Fri, 06 Sep 2024 15:42:47 +0200
parents db7cf82a881b
children 3476dc32c39b
files Tests/Tests.py
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Thu Sep 05 18:54:17 2024 +0200
+++ b/Tests/Tests.py	Fri Sep 06 15:42:47 2024 +0200
@@ -628,7 +628,7 @@
 
 
     def test_changes_extended(self):
-        if IsOrthancVersionAbove(_REMOTE, 1, 12, 5) and DoGet(_REMOTE, '/system').get("Capabilities").get("HasExtendedChanges"):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 5) and DoGet(_REMOTE, '/system').get("Capabilities") and DoGet(_REMOTE, '/system').get("Capabilities").get("HasExtendedChanges"):
             # Check emptiness
             c = DoGet(_REMOTE, '/changes')
             self.assertEqual(0, len(c['Changes']))
@@ -1917,6 +1917,26 @@
         self.assertEqual('Instance', j['Type'])
         self.assertEqual(j['ID'], i['ID'])
 
+    def test_create_with_time_range(self):
+        i = DoPost(_REMOTE, '/tools/create-dicom',
+                   json.dumps({
+                    'PatientName' : 'Jodogne',
+                    'Modality' : 'CT',
+                    'SOPClassUID' : '1.2.840.10008.5.1.4.1.1.1',
+                    'TimeRange': '3.12\\4.12',
+                    'PixelData' : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==' # red dot in RGBA
+                    }))
+
+        self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip())
+        self.assertEqual('CT', DoGet(_REMOTE, '/instances/%s/content/Modality' % i['ID']).strip())
+
+        png = GetImage(_REMOTE, '/instances/%s/preview' % i['ID'])
+        self.assertEqual((5, 5), png.size)
+
+        j = DoGet(_REMOTE, i['Path'])
+        self.assertEqual('Instance', j['Type'])
+        self.assertEqual(j['ID'], i['ID'])
+
 
     def test_pilates(self):
         # "SCU failed error when accessing orthanc with osirix" by