diff --git a/requirements.txt b/requirements.txt index be8a8cf..7b5c90c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ python3-colorama==0.4.3 -websocket-client==0.57.0 - +websocket-client~=1.2.3 +zeroconf~=0.36.9 +colorama~=0.4.4 +PyYAML~=3.13 +requests~=2.27.0 \ No newline at end of file diff --git a/test_api/apitest/runner.py b/test_api/apitest/runner.py index ff11004..755ec59 100644 --- a/test_api/apitest/runner.py +++ b/test_api/apitest/runner.py @@ -69,7 +69,7 @@ class RunTestsController(object): if not conn_timeout: print_error("Could not connect to WS! Exiting.") - def on_message(self, message: str) -> None: + def on_message(self, ws_obj: object, message: str) -> None: if self.debug: print_debug(f"Message returned: {message}") if not self.received: @@ -78,15 +78,15 @@ class RunTestsController(object): self.ws_data.append(message) @staticmethod - def on_open() -> None: - print_info("Socket Listener Opened") + def on_open(ws_obj: object) -> None: + print_info(f"Socket Listener Opened") @staticmethod def on_close() -> None: print_info("Socket Listener Closed") @staticmethod - def on_error(error: str) -> None: + def on_error(ws_obj: object, error: str) -> None: print_error(f'WebSocket Error: {error}') def load_and_check_sockets(self, first_run: bool = False) -> bool: @@ -117,8 +117,9 @@ class RunTestsController(object): parser.add_argument('rargs', nargs='*', default=[]) a = parser.parse_args() f_open = f'{a.rargs[0]}' + print(f_open) with open(f_open, 'r') as file: - commands = yaml.load(file, Loader=yaml.FullLoader) + commands = yaml.load(file, Loader=yaml.SafeLoader) for step in commands: if step == 'process_name': print_info(f'Processing file {commands[step]}') diff --git a/test_api/apitest/zero.py b/test_api/apitest/zero.py index 12a07cd..209ec57 100644 --- a/test_api/apitest/zero.py +++ b/test_api/apitest/zero.py @@ -36,7 +36,7 @@ def check_for_openlp(type: str) -> str: def add_service(self, zeroconf: Zeroconf, type: str, name: str): info = zeroconf.get_service_info(type, name) - # print_info(f'Service {name} added, service info: {info}') + print_info(f'Service {name} added, service info: {info}') if info.name.startswith("OpenLP"): print_info(f'Service {name} found') self.port = str(info.port) diff --git a/test_api/runner.py b/test_api/runner.py index 7adc814..160935b 100644 --- a/test_api/runner.py +++ b/test_api/runner.py @@ -31,11 +31,14 @@ def start() -> None: print_text('Check OpenLP is running') op_address, op_http_port = check_for_openlp('http') if not op_http_port: - print_error('OpenLP is not running - aborting') - return + print_error('OpenLP is not found - defaulting to 4316') + op_http_port = 4316 else: print_ok(f'OpenLP is running on port (http) {op_http_port}') _, op_ws_port = check_for_openlp('ws') + if not op_ws_port: + print_error('OpenLP is not found - defaulting to 4317') + op_ws_port = 4317 print_ok(f'OpenLP is running network Address {op_address}') print_ok(f'OpenLP is running on port (ws) {op_ws_port}') rtc = RunTestsController(op_address, op_http_port, op_ws_port)