changeset 262:045a45c3f945

test_log_level
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Feb 2020 17:22:11 +0100
parents b8cdb0aef4b9
children a2719263fd04
files Tests/Tests.py
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Feb 04 11:43:14 2020 +0100
+++ b/Tests/Tests.py	Fri Feb 14 17:22:11 2020 +0100
@@ -4877,3 +4877,27 @@
         # https://groups.google.com/d/msg/orthanc-users/aphG_h1AHVg/rfOTtTPTAgAJ
         UploadInstance(_REMOTE, '2019-06-17-VedranZdesic.dcm')
         DoPost(_REMOTE, '/studies/0c4aca1d-c107a241-6659d6aa-594c674a-a468b94a/modify', {})
+
+
+    def test_log_level(self):
+        # https://bitbucket.org/sjodogne/orthanc/issues/65/
+        original = DoGet(_REMOTE, '/tools/log-level')
+        
+        DoPut(_REMOTE, '/tools/log-level', 'default')
+        self.assertEqual('default', DoGet(_REMOTE, '/tools/log-level'))
+        DoGet(_REMOTE, '/system')
+
+        DoPut(_REMOTE, '/tools/log-level', 'verbose')
+        self.assertEqual('verbose', DoGet(_REMOTE, '/tools/log-level'))
+        DoGet(_REMOTE, '/system')
+
+        DoPut(_REMOTE, '/tools/log-level', 'trace')
+        self.assertEqual('trace', DoGet(_REMOTE, '/tools/log-level'))
+        DoGet(_REMOTE, '/system')
+
+        self.assertRaises(Exception, lambda: DoPut(_REMOTE, '/tools/log-level', 'nope'))
+        
+        # Switch back to the original log level
+        DoPut(_REMOTE, '/tools/log-level', original)
+        
+