From 0e27b8b7b6c7804f4a0175066c1daebd891944d9 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 30 Sep 2010 17:45:26 +0000 Subject: [PATCH] Move regression test for #11157 into the main functional test. svn path=/plone.app.discussion/trunk/; revision=40458 --- plone/app/discussion/tests/functional.txt | 27 +++++ .../tests/test_regression_pickle.py | 98 ------------------- 2 files changed, 27 insertions(+), 98 deletions(-) delete mode 100644 plone/app/discussion/tests/test_regression_pickle.py diff --git a/plone/app/discussion/tests/functional.txt b/plone/app/discussion/tests/functional.txt index eb92d98..de4853c 100644 --- a/plone/app/discussion/tests/functional.txt +++ b/plone/app/discussion/tests/functional.txt @@ -160,3 +160,30 @@ Now we can post an anonymous comment. >>> 'This is an anonymous comment' in unprivileged_browser.contents True + + +Regression Test +--------------- + +Make sure we still can edit the content object after a comment has been posted. +This is a regression test for http://dev.plone.org/plone/ticket/11157 +(TypeError: Can't pickle objects in acquisition wrappers). + +Login as admin. + + >>> browser.open(portal_url + '/logout') + >>> browser.open(portal_url + '/login_form') + >>> browser.getControl(name='__ac_name').value = 'admin' + >>> browser.getControl(name='__ac_password').value = 'secret' + >>> browser.getControl(name='submit').click() + +Edit the content object. + + >>> browser.open(urldoc1 + "/edit") + >>> browser.getControl(name='text').value = "Lorem ipsum" + >>> browser.getControl(name='form.button.save').click() + +Make sure the edit was successful. + + >>> 'Lorem ipsum' in browser.contents + True diff --git a/plone/app/discussion/tests/test_regression_pickle.py b/plone/app/discussion/tests/test_regression_pickle.py deleted file mode 100644 index 00f09db..0000000 --- a/plone/app/discussion/tests/test_regression_pickle.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- -import unittest -import time -from datetime import datetime - -from AccessControl import Unauthorized - -from zope.component import createObject, queryUtility - -from OFS.Image import Image - -from zope.interface import alsoProvides -from zope.publisher.browser import TestRequest -from zope.annotation.interfaces import IAttributeAnnotatable -from z3c.form.interfaces import IFormLayer - -from zope.component import provideAdapter -from zope.publisher.interfaces.browser import IBrowserRequest - -from zope.interface import Interface -from zope.component import getMultiAdapter - -from plone.registry.interfaces import IRegistry - -from Products.CMFCore.utils import getToolByName - -from Products.CMFPlone.tests import dummy - -from Products.Five.testbrowser import Browser - -from Products.PloneTestCase.ptc import PloneTestCase -from Products.PloneTestCase.ptc import FunctionalTestCase -from Products.PloneTestCase.setup import portal_owner, default_password - -from plone.app.discussion.browser.comments import CommentsViewlet -from plone.app.discussion.browser.comments import CommentForm -from plone.app.discussion.interfaces import IConversation -from plone.app.discussion.tests.layer import DiscussionLayer - - -class TestPostCommentsRegression(FunctionalTestCase): - - layer = DiscussionLayer - - def testCantPickleObjectsInAcquisitionWrapper(self): - """https://dev.plone.org/plone/ticket/11157 - """ - - browser = Browser() - portal_url = self.portal.absolute_url() - browser.handleErrors = False - browser.open(portal_url + '/login_form') - browser.getControl(name='__ac_name').value = portal_owner - browser.getControl(name='__ac_password').value = default_password - browser.getControl(name='submit').click() - browser.open(portal_url) - browser.getLink(id='document').click() - browser.getControl(name='title').value = "Doc1" - browser.getControl(name='allowDiscussion:boolean').value = True - browser.getControl(name='form.button.save').click() - browser.getLink('Publish').click() - urldoc1 = browser.url - - # Enable anonymous comment - browser.open(portal_url+'/@@discussion-settings') - browser.getControl(name='form.widgets.anonymous_comments:list').value = [True] - browser.getControl(name='form.buttons.save').click() - - def post(poster=None, password=None, url=urldoc1): - if poster: - browser.open(portal_url + '/logout') - browser.open(portal_url + '/login_form') - browser.getControl(name='__ac_name').value = poster - browser.getControl(name='__ac_password').value = password - browser.getControl(name='submit').click() - browser.open(url) - browser.getControl(name='form.widgets.text').value = "%s Lorem ipsum" % poster - submit = browser.getControl(name='form.buttons.comment') - submit.click() - browser.open(portal_url + '/logout') - - # Login and post comment as Anonymous - post() - - browser.open(portal_url + '/login_form') - browser.getControl(name='__ac_name').value = portal_owner - browser.getControl(name='__ac_password').value = default_password - browser.getControl(name='submit').click() - - browser.open(portal_url + '/doc1/edit') - browser.getControl(name='title').value = "New Doc1" - browser.getControl(name='text').value = "Lorem ipsum" - browser.getControl(name='form.button.save').click() - - self.failUnless('Lorem ipsum' in browser.contents) - -def test_suite(): - return unittest.defaultTestLoader.loadTestsFromName(__name__)