changeset 516:3a8e4de5aff7

merge
author Alain Mazy <am@osimis.io>
date Tue, 04 Apr 2023 12:09:00 +0200
parents 5dca7ef42156 (current diff) 010cd694254b (diff)
children 692f2956ddab
files Tests/Tests.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Apr 04 12:05:27 2023 +0200
+++ b/Tests/Tests.py	Tue Apr 04 12:09:00 2023 +0200
@@ -9329,3 +9329,26 @@
             self.assertEqual(upload1["ParentStudy"], upload2["ParentStudy"])
             self.assertEqual(2, len(changes2))
             self.assertEqual(changes1[0], changes2[0])
+
+    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('', DoPut(_REMOTE, '%s/labels/hello' % base))  # Ignore double tagging
+                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))
+