def test_sub(self, client): """ a child with content under the root """ root = Node.root() Type1(node=root, title="Root").save() child = root.add("child") Type1(node=child, title="Child").save() request = create_request("GET", "/") handler = MainHandlerTestable(request=request, instance=child) assert handler.breadcrumb() == [("Home", root.get_absolute_url()), ("Child", "")] ## root should ignore child handler = MainHandlerTestable(request=request, instance=root) assert handler.breadcrumb() == [("Home", '')]
def test_attached_root(self, client): """ A root node with content attached. Its name should not be its title but 'Home' """ root = Node.root() Type1(node=root, title="The rootnode of this site").save() request = create_request("GET", "/") handler = MainHandlerTestable(request=request, instance=root) assert handler.breadcrumb() == [("Home", '')]
def test_parent_instance(self, client): """ handler initialized with a parent but no instance. Should mean edit mode, but for now assume custom breadcrumb context """ root = Node.root() Type1(node=root, title="Root").save() request = create_request("GET", "/") handler = MainHandlerTestable(request=request, kw=dict(parent=root)) assert handler.breadcrumb() == []
def test_subsub_unattached(self, client): """ a child with content under the root, lowest child unattached """ root = Node.root() Type1(node=root, title="Root").save() child = root.add("child") Type1(node=child, title="Child").save() child2 = child.add("child2") request = create_request("GET", "/") handler = MainHandlerTestable(request=request, instance=child2) assert handler.breadcrumb() == [("Home", root.get_absolute_url()), ("Child", child.get_absolute_url()), ("Unattached node /child/child2", "")]
def test_subsub_operation(self, client): """ a child with content under the root """ root = Node.root() Type1(node=root, title="Root").save() child = root.add("child") Type1(node=child, title="Child").save() child2 = child.add("child2") Type1(node=child2, title="Child2").save() request = create_request("GET", "/") handler = MainHandlerTestable(request=request, instance=child2) assert handler.breadcrumb(operation="Edit") == [ ("Home", root.get_absolute_url()), ("Child", child.get_absolute_url()), ("Child2", child2.get_absolute_url()), ("Edit", "")]
def test_unattached_root(self, client): root = Node.root() request = create_request("GET", "/edit") handler = MainHandlerTestable(request=request, instance=root) assert handler.breadcrumb() == [("Unattached rootnode", '')]