From 072f903c3a0ae88015b423b33b1a02433ed23c8e Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Fri, 3 Jul 2009 08:03:09 +0000 Subject: [PATCH] in_response_to metadata added. svn path=/plone.app.discussion/trunk/; revision=27789 --- plone/app/discussion/browser/moderation.pt | 2 +- plone/app/discussion/catalog.py | 4 ++++ plone/app/discussion/configure.zcml | 1 + plone/app/discussion/profiles/default/catalog.xml | 1 + plone/app/discussion/tests/test_catalog.py | 6 ++++++ plone/app/discussion/tests/test_indexers.py | 14 ++++++-------- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index 60f4df0..2fe71ad 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -116,7 +116,7 @@ + tal:content="item/in_response_to" /> + diff --git a/plone/app/discussion/profiles/default/catalog.xml b/plone/app/discussion/profiles/default/catalog.xml index 1737dda..51428c5 100644 --- a/plone/app/discussion/profiles/default/catalog.xml +++ b/plone/app/discussion/profiles/default/catalog.xml @@ -12,5 +12,6 @@ + diff --git a/plone/app/discussion/tests/test_catalog.py b/plone/app/discussion/tests/test_catalog.py index dee593b..131a044 100644 --- a/plone/app/discussion/tests/test_catalog.py +++ b/plone/app/discussion/tests/test_catalog.py @@ -22,6 +22,7 @@ class CatalogSetupTest(PloneTestCase): self.failUnless('total_comments' in self.portal.portal_catalog.indexes()) self.failUnless('commentators' in self.portal.portal_catalog.indexes()) self.failUnless('total_comments' in self.portal.portal_catalog.schema()) + self.failUnless('in_response_to' in self.portal.portal_catalog.schema()) def test_collection_criteria_installed(self): try: @@ -212,5 +213,10 @@ class CommentCatalogTest(PloneTestCase): def test_creator(self): self.assertEquals(self.comment_brain.Creator, 'Jim') + def test_in_response_to(self): + # make sure in_response_to returns the title or id of the content + # object the comment was added to + self.assertEquals(self.comment_brain.in_response_to, 'doc1') + def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) \ No newline at end of file diff --git a/plone/app/discussion/tests/test_indexers.py b/plone/app/discussion/tests/test_indexers.py index 156f39f..4cf09d4 100644 --- a/plone/app/discussion/tests/test_indexers.py +++ b/plone/app/discussion/tests/test_indexers.py @@ -144,14 +144,12 @@ class CommentIndexersTest(PloneTestCase): def test_creator(self): self.assertEquals(catalog.creator(self.comment)(), ('Jim')) - def test_in_reply_to(self): - pass - - def test_review_state(self): - pass - - def test_object_provides(self): - pass + def test_in_response_to(self): + # make sure in_response_to returns the title or id of the content + # object the comment was added to + self.assertEquals(catalog.in_response_to(self.comment)(), 'doc1') + self.portal.doc1.title = 'Document 1' + self.assertEquals(catalog.in_response_to(self.comment)(), 'Document 1') def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__) \ No newline at end of file