def test_get_menu_without_menubar_2(): class MB: def addMenu(self, text): return 'menu' parent = Mock(menubar=MB()) plugin = Plugin(parent) assert plugin.getMenu('file') == 'menu'
def test_get_menu_without_menubar(): parent = Mock(menubar=None) plugin = Plugin(parent) plugin._menu_map['file'] = 'menu' assert plugin.getMenu('file') == 'menu'
def test_get_menu_with_menubar(): parent = MagicMock() parent.menubar.menus = {'file': 'menu'} plugin = Plugin(parent) assert plugin.getMenu('file') == 'menu'