def test_primary(self, client): """ a type with primary should behave differently """ class DummyNode(object): def content(self): class DummyType(Spoke): model = DummyContent children = (Type1Type, Type2Type) primary = Type1Type add_to_index = False @classmethod def name(cls): return cls.model.get_name() type_registry.register(DummyType) return DummyContent() toolbar = Toolbar(DummyNode(), superuser_request("/"), "view") children = toolbar.children() assert len(children) == 1 assert children[0]['name'] == Type2Type.name() assert children[0]['title'] == Type2Type.title assert children[0]['icon_path'] == Type2Type.full_type_icon_path() primary = toolbar.primary() assert primary assert primary['name'] == Type1Type.name() assert primary['title'] == Type1Type.title assert primary['icon_path'] == Type1Type.full_type_icon_path()
def test_primary_unattached(self, client): """ an unattached node has no primary content """ toolbar = Toolbar(Node.root(), superuser_request("/"), "view") assert toolbar.primary() is None