Fix menu test cases by not reseting the entire menu class cache,
but only specific temporary test menus. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -62,8 +62,8 @@ class Menu(object):
|
||||
return cls._registry[name]
|
||||
|
||||
@classmethod
|
||||
def reset(cls):
|
||||
cls._registry = {}
|
||||
def remove(cls, name):
|
||||
del cls._registry[name]
|
||||
|
||||
def __init__(self, name, icon=None, label=None):
|
||||
if name in self.__class__._registry:
|
||||
|
||||
@@ -121,12 +121,16 @@ class MenuClassTestCase(GenericViewTestCase):
|
||||
name=TEST_PERMISSION_NAME, label=TEST_PERMISSION_LABEL
|
||||
)
|
||||
|
||||
Menu.reset()
|
||||
self.menu = Menu(name=TEST_MENU_NAME)
|
||||
self.sub_menu = Menu(name=TEST_SUBMENU_NAME)
|
||||
self.link = Link(text=TEST_LINK_TEXT, view=TEST_VIEW_NAME)
|
||||
Permission.invalidate_cache()
|
||||
|
||||
def tearDown(self):
|
||||
Menu.remove(name=TEST_MENU_NAME)
|
||||
Menu.remove(name=TEST_SUBMENU_NAME)
|
||||
super(MenuClassTestCase, self).tearDown()
|
||||
|
||||
def test_null_source_link_unbinding(self):
|
||||
self.menu.bind_links(links=(self.link,))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user