Mercurial > hg > orthanc-tests
diff NewTests/helpers.py @ 490:10a47656e34f
new tests for MaximumStorageMode
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 09 Aug 2022 17:57:57 +0200 |
parents | ddfabe1fbee1 |
children | 80ba6f1d521c |
line wrap: on
line diff
--- a/NewTests/helpers.py Mon Aug 08 10:55:47 2022 +0200 +++ b/NewTests/helpers.py Tue Aug 09 17:57:57 2022 +0200 @@ -2,7 +2,7 @@ from orthanc_api_client import OrthancApiClient import subprocess import json -import time +import os import typing import shutil from threading import Thread @@ -17,6 +17,7 @@ "RemoteAccessAllowed": True } + class Helpers: orthanc_under_tests_hostname: str = 'localhost' @@ -35,6 +36,14 @@ return f"http://{cls.orthanc_under_tests_hostname}:{cls.orthanc_under_tests_http_port}" @classmethod + def get_orthanc_ip(cls): + return cls.orthanc_under_tests_hostname + + @classmethod + def get_orthanc_dicom_port(cls): + return cls.orthanc_under_tests_dicom_port + + @classmethod def is_docker(cls): return cls.orthanc_under_tests_exe is None and cls.orthanc_under_tests_docker_image is not None @@ -42,6 +51,19 @@ def is_exe(cls): return cls.orthanc_under_tests_exe is not None and cls.orthanc_under_tests_docker_image is None + @classmethod + def find_executable(cls, name): + p = os.path.join('/usr/local/bin', name) + if os.path.isfile(p): + return p + + p = os.path.join('/usr/local/sbin', name) + if os.path.isfile(p): + return p + + return name + + class OrthancTestCase(unittest.TestCase): o: OrthancApiClient = None # the orthanc under tests api client