def test_rename_to_empty_name(self): from kotti.views.edit import move_node root = DBSession().query(Node).get(1) child = root['child'] = Document(title=u"Child") request = DummyRequest() request.params['rename'] = u'on' request.params['name'] = u'' request.params['title'] = u'foo' move_node(child, request) self.assertEqual(request.session.pop_flash('error'), [u'Name and title are required.'])
def test_paste_without_edit_permission(self): from kotti.views.edit import move_node root = DBSession().query(Node).get(1) request = DummyRequest() request.params['paste'] = u'on' self.config.testing_securitypolicy(permissive=False) # We need to have the 'edit' permission on the original object # to be able to cut and paste: request.session['kotti.paste'] = (1, 'cut') self.assertRaises(Forbidden, move_node, root, request) # We don't need 'edit' permission if we're just copying: request.session['kotti.paste'] = (1, 'copy') response = move_node(root, request) self.assertEqual(response.status, '302 Found')