Skip to content

Commit

Permalink
Keep namespace unchanged when requesting SYSTEM resources
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Jul 7, 2023
1 parent c5a37e8 commit 9786ca5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion ovos_gui/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ def handle_show_page(self, message: Message):
if not page_resource_dirs and page_ids_to_show and \
all((x.startswith("SYSTEM") for x in page_ids_to_show)):
page_resource_dirs = {"all": self._system_res_dir}
namespace_name = "system"

if not all((page_ids_to_show, page_resource_dirs)):
LOG.info(f"Handling legacy page request: data={message.data}")
Expand Down
8 changes: 5 additions & 3 deletions test/unittests/test_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ def test_handle_show_page(self):
"page_names": ["SYSTEM_TextFrame"]})
self.namespace_manager.handle_show_page(message)
expected_page = GuiPage(None, "SYSTEM_TextFrame", True, 0,
"SYSTEM_TextFrame", "system",
"SYSTEM_TextFrame", "skill_no_res",
{"all": self.namespace_manager._system_res_dir})
self.namespace_manager._legacy_show_page.assert_called_once()
self.namespace_manager._activate_namespace.assert_called_with("system")
self.namespace_manager._activate_namespace.assert_called_with(
"skill_no_res")
self.namespace_manager._load_pages.assert_called_with([expected_page],
2)
self.namespace_manager._update_namespace_persistence.\
Expand All @@ -354,7 +355,8 @@ def test_handle_show_page(self):
self.namespace_manager._legacy_show_page = real_legacy_show_page
self.namespace_manager._activate_namespace = real_activate_namespace
self.namespace_manager._load_pages = real_load_pages
self.namespace_manager._update_namespace_persistence = real_update_persistence
self.namespace_manager._update_namespace_persistence = \
real_update_persistence

def test_handle_show_page_invalid_message(self):
namespace = Namespace("foo")
Expand Down

0 comments on commit 9786ca5

Please sign in to comment.