def test_button_state_all(self, client, root, toolbar_registry): """ A toolbar action with states=() always shows """ Type1Type.create(node=root).save() toolbar = Toolbar(root, superuser_request("/"), "edit") toolbar_registry.register(mock.Mock(type="button", states=())) assert len(toolbar.button_actions()) == 1
def test_button_state_mismatch(self, client, root, toolbar_registry): """ If an explicit state is given, it must match with toolbar status """ Type1Type.create(node=root).save() toolbar = Toolbar(root, superuser_request("/"), "edit") toolbar_registry.register(mock.Mock(type="button", states=("view",))) assert len(toolbar.button_actions()) == 0
def test_no_button_actions(self, client, root, toolbar_registry): """ A node with content without restrictions """ Type1Type.create(node=root).save() toolbar = Toolbar(root, superuser_request("/"), "view") assert len(toolbar.button_actions()) == 0