From c27ca3f06ed3eeeab459995708027bb129d8c06f Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 27 Sep 2023 18:40:22 -0700 Subject: [PATCH] Troubleshoot test failure Revert refactored config change to match existing parameter name --- README.md | 2 +- ovos_gui/bus.py | 4 ++-- ovos_gui/namespace.py | 7 +++---- test/unittests/test_bus.py | 8 ++++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5117cd7..a772b0b 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ under mycroft.conf // This example describes a configuration where the HOST system has collected // GUI resources at `/tmp/gui_files`. The container path for these files will be // {XDG_CACHE_HOME}/ovos_gui_file_server - // "ui_file_path": "/tmp/gui_files", + // "gui_file_path": "/tmp/gui_files", // Optionally specify a default qt version for connected clients that don't report it "default_qt_version": 5 diff --git a/ovos_gui/bus.py b/ovos_gui/bus.py index 1b3879b..29bc669 100644 --- a/ovos_gui/bus.py +++ b/ovos_gui/bus.py @@ -133,7 +133,7 @@ def get_client_pages(self, namespace): client_pages = [] server_url = self.ns_manager.gui_file_server.url if \ self.ns_manager.gui_file_server else \ - self.ns_manager.ui_file_path + self.ns_manager.gui_file_path for page in namespace.pages: uri = page.get_uri(self.framework, server_url) client_pages.append(uri) @@ -262,7 +262,7 @@ def send_gui_pages(self, pages: List[GuiPage], namespace: str, """ server_url = self.ns_manager.gui_file_server.url if \ self.ns_manager.gui_file_server else \ - self.ns_manager.ui_file_path + self.ns_manager.gui_file_path framework = self.framework message = { diff --git a/ovos_gui/namespace.py b/ovos_gui/namespace.py index a8de7e0..1ea0a58 100644 --- a/ovos_gui/namespace.py +++ b/ovos_gui/namespace.py @@ -459,7 +459,6 @@ def __init__(self, core_bus: MessageBusClient): self._ready_event = Event() self.gui_file_server = None self.gui_file_path = None - self.ui_file_path = None self._connected_frameworks: List[str] = list() self._init_gui_file_share() self._define_message_handlers() @@ -470,13 +469,13 @@ def _active_homescreen(self) -> str: def _init_gui_file_share(self): """ - Initialize optional GUI file collection. if `ui_file_path` is + Initialize optional GUI file collection. if `gui_file_path` is defined, resources are assumed to be referenced outside this container. If `gui_file_server` is defined, resources will be served via HTTP """ config = Configuration().get("gui", {}) - self.ui_file_path = config.get("ui_file_path") - if config.get("gui_file_server") or self.ui_file_path: + self.gui_file_path = config.get("gui_file_path") + if config.get("gui_file_server") or self.gui_file_path: from ovos_utils.xdg_utils import xdg_cache_home self.gui_file_path = config.get("server_path") or \ join(xdg_cache_home(), "ovos_gui_file_server") diff --git a/test/unittests/test_bus.py b/test/unittests/test_bus.py index 862d8bd..1ee9c94 100644 --- a/test/unittests/test_bus.py +++ b/test/unittests/test_bus.py @@ -89,6 +89,10 @@ def test_get_client_pages(self): page_2.get_uri.return_value = "page_2_uri" test_namespace.pages = [page_1, page_2] + # Specify no host path mapping + self.handler.ns_manager.gui_file_path = None + # TODO: Test with host path mapping + # Test no server_url self.handler.ns_manager.gui_file_server = None pages = self.handler.get_client_pages(test_namespace) @@ -129,6 +133,10 @@ def test_send_gui_pages(self): page_2 = GuiPage(None, "", False, False) page_2.get_uri = Mock(return_value="page_2") + # Specify no host path mapping + self.handler.ns_manager.gui_file_path = None + # TODO: Test with host path mapping + # Test no server_url self.handler.ns_manager.gui_file_server = None self.handler._framework = "qt5"