Skip to content

Commit

Permalink
Troubleshoot test failure
Browse files Browse the repository at this point in the history
Revert refactored config change to match existing parameter name
  • Loading branch information
NeonDaniel committed Sep 28, 2023
1 parent e02441f commit c27ca3f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ovos_gui/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
7 changes: 3 additions & 4 deletions ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand Down
8 changes: 8 additions & 0 deletions test/unittests/test_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit c27ca3f

Please sign in to comment.