From 7e391971142219fda24e6eb5e6d3096d8f811af4 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 28 Nov 2010 09:51:35 +0000 Subject: [PATCH] hudson buildout added. svn path=/plone.app.discussion/trunk/; revision=46002 --- CHANGES.txt | 4 ++ hudson.cfg | 13 +++++++ plone/app/discussion/configure.zcml | 6 ++- plone/app/discussion/tests/test_comment.py | 43 ++++++++++++++++++---- setup.py | 1 + 5 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 hudson.cfg diff --git a/CHANGES.txt b/CHANGES.txt index 3d64c0c..aa42631 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,10 @@ Changelog 1.0RC1 (unreleased) ------------------- +- Make sure comment UIDs in the catalog are always unique. This fixes + http://dev.plone.org/plone/ticket/10652. + [timo] + - Fix 'check all' on batch moderation page. [davisagli] diff --git a/hudson.cfg b/hudson.cfg new file mode 100644 index 0000000..cbe1565 --- /dev/null +++ b/hudson.cfg @@ -0,0 +1,13 @@ +[buildout] +extends = + buildout.cfg + http://svn.plone.org/svn/collective/buildout/hudson/hudson.cfg + +package-name = plone.app.discussion +package-directories = . + +jstestdriver-directories = + plone/app/discussion + +browsers = + /usr/bin/firefox \ No newline at end of file diff --git a/plone/app/discussion/configure.zcml b/plone/app/discussion/configure.zcml index e7b9d2f..db814eb 100644 --- a/plone/app/discussion/configure.zcml +++ b/plone/app/discussion/configure.zcml @@ -10,10 +10,13 @@ - + + + + @@ -43,6 +46,7 @@ + diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index cc115a1..0f3f6eb 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -6,9 +6,10 @@ import logging import unittest from zope.component import createObject - from zope.component import getMultiAdapter +from Products.CMFCore.utils import getToolByName + from Products.PloneTestCase.ptc import PloneTestCase from plone.app.discussion.tests.layer import DiscussionLayer @@ -26,13 +27,12 @@ class CommentTest(PloneTestCase): layer = DiscussionLayer def afterSetUp(self): - """Create a document. - """ + # First we need to create some content. self.loginAsPortalOwner() - self.portal.invokeFactory(id='doc1', - title='Document 1', - type_name='Document') - + typetool = self.portal.portal_types + typetool.constructContent('Document', self.portal, 'doc1') + self.catalog = getToolByName(self.portal, 'portal_catalog') + def test_factory(self): comment1 = createObject('plone.Comment') self.assert_(IComment.providedBy(comment1)) @@ -83,6 +83,35 @@ class CommentTest(PloneTestCase): conversation.addComment(comment1) self.assertEquals(u"Tarek Ziadé on Document äüö", comment1.Title()) + def test_uid(self): + conversation = IConversation(self.portal.doc1) + comment1 = createObject('plone.Comment') + conversation.addComment(comment1) + comment_brain = self.catalog.searchResults( + portal_type = 'Discussion Item')[0] + self.failUnless(comment_brain.UID) + + def test_uid_is_unique(self): + conversation = IConversation(self.portal.doc1) + comment1 = createObject('plone.Comment') + conversation.addComment(comment1) + comment2 = createObject('plone.Comment') + conversation.addComment(comment2) + brains = self.catalog.searchResults( + portal_type = 'Discussion Item') + self.assertNotEquals(brains[0].UID, None) + self.assertNotEquals(brains[1].UID, None) + self.assertNotEquals(brains[0].UID, brains[1].UID) + + def test_comment_uid_differs_from_content_uid(self): + conversation = IConversation(self.portal.doc1) + comment1 = createObject('plone.Comment') + conversation.addComment(comment1) + comment_brain = self.catalog.searchResults( + portal_type = 'Discussion Item')[0] + self.assertNotEquals(comment_brain.UID, None) + self.assertNotEquals(self.portal.doc1.UID, comment_brain.UID) + def test_creator(self): comment1 = createObject('plone.Comment') comment1.creator = "Jim" diff --git a/setup.py b/setup.py index e9278dc..022e09a 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ setup(name='plone.app.discussion', 'collective.monkeypatcher', 'plone.app.layout', 'plone.app.registry', + 'plone.app.uuid', 'plone.app.z3cform', 'plone.indexer', 'plone.registry',