changeset 512:e2ce0edb9002

/system
author Alain Mazy <am@osimis.io>
date Wed, 29 Mar 2023 19:28:27 +0200
parents 933fe1bbce4f
children 5824f0545d5b 5dca7ef42156
files GenerateConfigurationForTests.py Tests/Tests.py
diffstat 2 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/GenerateConfigurationForTests.py	Sat Mar 25 12:30:14 2023 +0100
+++ b/GenerateConfigurationForTests.py	Wed Mar 29 19:28:27 2023 +0200
@@ -164,6 +164,10 @@
     '0009,0010' : [ 'LO', 'Private data element', 1, 1, 'Lunit' ],  # For issue 168
 }
 
+config['UserMetadata'] = {
+    'my-metadata': 1098
+}
+
 config['DefaultPrivateCreator'] = 'Lunit'  # For issue 168
 
 config['DicomWeb'] = {
--- a/Tests/Tests.py	Sat Mar 25 12:30:14 2023 +0100
+++ b/Tests/Tests.py	Wed Mar 29 19:28:27 2023 +0200
@@ -208,15 +208,19 @@
         self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalDiskSize'])
         self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalUncompressedSize'])
 
+        systemInfo = DoGet(_REMOTE, '/system')
+
         if IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
-            system = DoGet(_REMOTE, '/system')
-            self.assertIn("MainDicomTags", system)
-            self.assertIn("Patient", system["MainDicomTags"])
-            self.assertIn("Study", system["MainDicomTags"])
-            self.assertIn("Series", system["MainDicomTags"])
-            self.assertIn("Instance", system["MainDicomTags"])
-
-        systemInfo = DoGet(_REMOTE, '/system')
+            self.assertIn("MainDicomTags", systemInfo)
+            self.assertIn("Patient", systemInfo["MainDicomTags"])
+            self.assertIn("Study", systemInfo["MainDicomTags"])
+            self.assertIn("Series", systemInfo["MainDicomTags"])
+            self.assertIn("Instance", systemInfo["MainDicomTags"])
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 0):
+            self.assertIn("UserMetadata", systemInfo)
+            self.assertEqual(1098, systemInfo['UserMetadata']['my-metadata'] )
+
         if systemInfo["Version"] == "mainline":
             print("Skipping version checks since you're currently in mainline")
             return
@@ -229,6 +233,7 @@
             self.assertFalse(IsOrthancVersionAbove(_LOCAL, 1, 8, 6))
 
 
+
     def test_upload(self):
         self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalDiskSize'])
         self.assertEqual('0', DoGet(_REMOTE, '/statistics')['TotalUncompressedSize'])
@@ -9238,3 +9243,8 @@
         self.assertEqual(1475, im.size[0])
         self.assertEqual(1475, im.size[1])
         self.assertEqual('c684b0050dc2523041240bf2d26dc85e', ComputeMD5(DoGet(_REMOTE, uri)))
+
+    def test_rest_api_write_to_file_system(self):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 0):
+            a = UploadInstance(_REMOTE, '2022-11-14-RLEPlanarConfiguration.dcm') ['ID']
+            self.assertRaises(Exception, lambda: DoPost(_REMOTE, '/instances/%s/export' % a, '/tmp/test.dcm'))