changeset 513:5824f0545d5b

added test_labels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Apr 2023 20:50:08 +0200
parents e2ce0edb9002
children 010cd694254b
files Tests/Tests.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Wed Mar 29 19:28:27 2023 +0200
+++ b/Tests/Tests.py	Mon Apr 03 20:50:08 2023 +0200
@@ -9248,3 +9248,24 @@
         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'))
+
+    def test_labels(self):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 0):
+            u = UploadInstance(_REMOTE, 'DummyCT.dcm')['ID']
+            patient = DoGet(_REMOTE, '/instances/%s/patient' % u) ['ID']
+            study = DoGet(_REMOTE, '/instances/%s/study' % u) ['ID']
+            series = DoGet(_REMOTE, '/instances/%s/series' % u) ['ID']
+
+            for base in [ '/instances/%s' % u,
+                          '/series/%s' % series,
+                          '/studies/%s' % study,
+                          '/series/%s' % series ]:
+                self.assertEqual(0, len(DoGet(_REMOTE, base) ['Labels']))
+                self.assertRaises(Exception, lambda: DoGet(_REMOTE, '%s/labels/hello' % base))
+                self.assertEqual('', DoDelete(_REMOTE, '%s/labels/hello' % base))
+                self.assertEqual(0, len(DoGet(_REMOTE, base) ['Labels']))
+                self.assertEqual('', DoPut(_REMOTE, '%s/labels/hello' % base))
+                self.assertEqual('', DoGet(_REMOTE, '%s/labels/hello' % base))
+                self.assertEqual('', DoDelete(_REMOTE, '%s/labels/hello' % base))
+                self.assertEqual(0, len(DoGet(_REMOTE, base) ['Labels']))
+                self.assertRaises(Exception, lambda: DoGet(_REMOTE, '%s/labels/hello' % base))