changeset 951:4b44c9333ccc

fix Tests/CheckHttpServerSecurity.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Aug 2026 17:27:17 +0200
parents ae065472bc8f
children ee46f818aa63
files Tests/CheckHttpServerSecurity.py
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/CheckHttpServerSecurity.py	Thu Aug 13 16:53:31 2026 +0200
+++ b/Tests/CheckHttpServerSecurity.py	Fri Aug 14 17:27:17 2026 +0200
@@ -59,22 +59,30 @@
         #shell=True
         )
 
-    time.sleep(1)
+    success = False
 
-    while True:
+    while process.poll() is None:  # Orthanc is still running
         try:
             system = Toolbox.DoGet(ORTHANC, '/system')
+            success = True
             break
         except:
-            time.sleep(0.1)
+            pass
+
+        time.sleep(0.1)
 
     process.terminate()
     process.wait()
 
-    return system['IsHttpServerSecure']
+    if success:
+        return system['IsHttpServerSecure']
+    else:
+        return None  # Orthanc has not started
 
 
 def Assert(b):
+    if b == None:
+        raise Exception('Bad result')
     if not b:
         raise Exception('Bad result')
 
@@ -100,15 +108,15 @@
             }))
 
 print('==== TEST 4 ====')
-Assert(not IsHttpServerSecure({
+Assert(IsHttpServerSecure({
             'RemoteAccessAllowed': True
-            }))
+            }) == None)
 
 print('==== TEST 5 (server application scenario) ====')
-Assert(not IsHttpServerSecure({
+Assert(IsHttpServerSecure({
             'RemoteAccessAllowed': True,
             'AuthenticationEnabled': False,
-            }))
+            }) == False)
 
 print('==== TEST 6 ====')
 Assert(IsHttpServerSecure({
@@ -118,9 +126,9 @@
             }))
 
 print('==== TEST 7 (Docker scenario) ====')
-Assert(not IsHttpServerSecure({
+Assert(IsHttpServerSecure({
             'RemoteAccessAllowed': True,
             'AuthenticationEnabled': True
-            }))
+            }) == None)
 
 print('Success!')