Skip to content

Commit

Permalink
Merge pull request #33457 from dimagi/es/menu-instances
Browse files Browse the repository at this point in the history
Fix pre 2.54 menu instance references
  • Loading branch information
snopoke authored Sep 11, 2023
2 parents 2c80e43 + ae6f87e commit cf55eb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _menu_xpaths_by_command(self):
# multiple menus can have the same ID - merge them first
xpaths_by_menu_id = defaultdict(set)
for menu in self.suite.menus:
xpaths_by_menu_id[menu.id] = menu.get_all_xpaths()
xpaths_by_menu_id[menu.id].update(menu.get_all_xpaths())

return defaultdict(set, {
command.id: xpaths_by_menu_id[menu.id]
Expand Down
6 changes: 5 additions & 1 deletion corehq/apps/app_manager/tests/test_suite_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,18 @@ def test_module_filter_instances_on_all_forms_merged_modules(self):
# and if two modules are display_in_root, then on forms in the other module too
factory = AppFactory(build_version='2.20.0') # enable_module_filtering
self.m0, self.m0f0 = factory.new_basic_module('m0', 'case1')
self.m0.module_filter = "instance('groups')/groups/"
self.m0.put_in_root = True

self.m1, self.m1f0 = factory.new_basic_module('m1', 'case1')
self.m1.module_filter = "instance('locations')/locations/"
self.m1.put_in_root = True

suite = factory.app.create_suite()
instance_xml = "<partial><instance id='locations' src='jr://fixture/locations' /></partial>"
instance_xml = """<partial>
<instance id='groups' src='jr://fixture/user-groups' />
<instance id='locations' src='jr://fixture/locations' />
</partial>"""
self.assertXmlPartialEqual(instance_xml, suite, "entry/command[@id='m0-f0']/../instance")
self.assertXmlPartialEqual(instance_xml, suite, "entry/command[@id='m1-f0']/../instance")

Expand Down

0 comments on commit cf55eb5

Please sign in to comment.