Mercurial > hg > orthanc-tests
comparison 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 |
comparison
equal
deleted
inserted
replaced
489:2078cb20a560 | 490:10a47656e34f |
---|---|
1 import unittest | 1 import unittest |
2 from orthanc_api_client import OrthancApiClient | 2 from orthanc_api_client import OrthancApiClient |
3 import subprocess | 3 import subprocess |
4 import json | 4 import json |
5 import time | 5 import os |
6 import typing | 6 import typing |
7 import shutil | 7 import shutil |
8 from threading import Thread | 8 from threading import Thread |
9 | 9 |
10 | 10 |
14 | 14 |
15 default_base_config = { | 15 default_base_config = { |
16 "AuthenticationEnabled": False, | 16 "AuthenticationEnabled": False, |
17 "RemoteAccessAllowed": True | 17 "RemoteAccessAllowed": True |
18 } | 18 } |
19 | |
19 | 20 |
20 class Helpers: | 21 class Helpers: |
21 | 22 |
22 orthanc_under_tests_hostname: str = 'localhost' | 23 orthanc_under_tests_hostname: str = 'localhost' |
23 orthanc_under_tests_http_port: int = 8052 | 24 orthanc_under_tests_http_port: int = 8052 |
33 @classmethod | 34 @classmethod |
34 def get_orthanc_url(cls): | 35 def get_orthanc_url(cls): |
35 return f"http://{cls.orthanc_under_tests_hostname}:{cls.orthanc_under_tests_http_port}" | 36 return f"http://{cls.orthanc_under_tests_hostname}:{cls.orthanc_under_tests_http_port}" |
36 | 37 |
37 @classmethod | 38 @classmethod |
39 def get_orthanc_ip(cls): | |
40 return cls.orthanc_under_tests_hostname | |
41 | |
42 @classmethod | |
43 def get_orthanc_dicom_port(cls): | |
44 return cls.orthanc_under_tests_dicom_port | |
45 | |
46 @classmethod | |
38 def is_docker(cls): | 47 def is_docker(cls): |
39 return cls.orthanc_under_tests_exe is None and cls.orthanc_under_tests_docker_image is not None | 48 return cls.orthanc_under_tests_exe is None and cls.orthanc_under_tests_docker_image is not None |
40 | 49 |
41 @classmethod | 50 @classmethod |
42 def is_exe(cls): | 51 def is_exe(cls): |
43 return cls.orthanc_under_tests_exe is not None and cls.orthanc_under_tests_docker_image is None | 52 return cls.orthanc_under_tests_exe is not None and cls.orthanc_under_tests_docker_image is None |
53 | |
54 @classmethod | |
55 def find_executable(cls, name): | |
56 p = os.path.join('/usr/local/bin', name) | |
57 if os.path.isfile(p): | |
58 return p | |
59 | |
60 p = os.path.join('/usr/local/sbin', name) | |
61 if os.path.isfile(p): | |
62 return p | |
63 | |
64 return name | |
65 | |
44 | 66 |
45 class OrthancTestCase(unittest.TestCase): | 67 class OrthancTestCase(unittest.TestCase): |
46 | 68 |
47 o: OrthancApiClient = None # the orthanc under tests api client | 69 o: OrthancApiClient = None # the orthanc under tests api client |
48 _orthanc_process = None | 70 _orthanc_process = None |