# HG changeset patch # User Sebastien Jodogne # Date 1786723814 -7200 # Node ID b727e73524404aeb574b36fd4ee6a54d61527adb # Parent ee46f818aa6360a4e8c989c9f7aef9fe6fba9e2e updated Tests/CheckHttpServerSecurity.py diff -r ee46f818aa63 -r b727e7352440 Tests/CheckHttpServerSecurity.py --- a/Tests/CheckHttpServerSecurity.py Fri Aug 14 17:31:29 2026 +0200 +++ b/Tests/CheckHttpServerSecurity.py Fri Aug 14 18:10:14 2026 +0200 @@ -43,11 +43,14 @@ os.mkdir(TMP) -ORTHANC = Toolbox.DefineOrthanc(username = 'orthanc', - password = 'orthanc') -def IsHttpServerSecure(config): +def IsHttpServerSecure(config, + username = 'orthanc', + password = 'orthanc'): + ORTHANC = Toolbox.DefineOrthanc(username = username, + password = password) + with open(CONFIG, 'w') as f: f.write(json.dumps(config)) @@ -98,13 +101,27 @@ 'RegisteredUsers' : { } })) -print('==== TEST 3 ====') -Assert(True, IsHttpServerSecure({ +print('==== TEST 3a ====') +Assert(False, IsHttpServerSecure({ 'RemoteAccessAllowed': False, 'AuthenticationEnabled': True, 'RegisteredUsers' : { 'orthanc' : 'orthanc' } })) +print('==== TEST 3b ====') +Assert(False, IsHttpServerSecure({ + 'RemoteAccessAllowed': False, + 'AuthenticationEnabled': True, + 'RegisteredUsers' : { 'alice' : 'orthanctest' } + }, 'alice', 'orthanctest')) + +print('==== TEST 3c ====') +Assert(True, IsHttpServerSecure({ + 'RemoteAccessAllowed': False, + 'AuthenticationEnabled': True, + 'RegisteredUsers' : { 'orthanc' : 'SECURE' } + }, 'orthanc', 'SECURE')) + print('==== TEST 4 ====') # Orthanc refuses to start since Orthanc 1.13.0 Assert(None, IsHttpServerSecure({ 'RemoteAccessAllowed': True @@ -116,13 +133,20 @@ 'AuthenticationEnabled': False, })) -print('==== TEST 6 ====') -Assert(True, IsHttpServerSecure({ +print('==== TEST 6a ====') +Assert(False, IsHttpServerSecure({ 'RemoteAccessAllowed': True, 'AuthenticationEnabled': True, 'RegisteredUsers' : { 'orthanc' : 'orthanc' } })) +print('==== TEST 6b ====') +Assert(True, IsHttpServerSecure({ + 'RemoteAccessAllowed': True, + 'AuthenticationEnabled': True, + 'RegisteredUsers' : { 'orthanc' : 'SECURE' } + }, 'orthanc', 'SECURE')) + print('==== TEST 7 (Docker scenario) ====') # Orthanc refuses to start since Orthanc 1.13.0 Assert(None, IsHttpServerSecure({ 'RemoteAccessAllowed': True,