def test_create_attach_get(self, client): """ get the form for attaching content """ root = Node.root() Type1(node=root).save() request = superuser_request("/", type=Type1.get_name()) handler = MainHandlerTestable(request=request, instance=root) create = handler.create(type=Type1.get_name(), attach=True) assert create['path'] == "wheelcms_axle/create.html" assert 'form' in create['context']
def test_create_get_root(self, client): """ test create on root - get """ root = Node.root() Type1(node=root).save() request = superuser_request("/", type=Type1.get_name()) handler = MainHandlerTestable(request=request, instance=root) create = handler.create() assert create['path'] == "wheelcms_axle/create.html" assert 'form' in create['context']
def test_attached_form(self, client): """ The form when attaching should not contain a slug field since it will be attached to an existing node """ root = Node.root() Type1(node=root).save() request = superuser_request("/") handler = MainHandlerTestable(request=request, instance=root) create = handler.create(type=Type1.get_name(), attach=True) form = create['context']['form'] assert 'slug' not in form.fields
def test_create_get(self, client): """ create should override and add Create operation crumb """ root = Node.root() Type1(node=root, title="Root").save() child = root.add("child") Type1(node=child, title="Child").save() request = superuser_request("/child/create") handler = MainHandlerTestable(request=request, instance=child) context = handler.create(type=Type1.get_name())['context'] assert 'breadcrumb' in context assert context['breadcrumb'] == [('Home', root.get_absolute_url()), ('Child', child.get_absolute_url()), ('Create "%s"' % Type1Type.title, '')]