From e31f90c4400beb8bcf8cb86c72d0244f68834116 Mon Sep 17 00:00:00 2001 From: Paul J Stevens Date: Tue, 12 Jun 2012 14:43:28 +0000 Subject: [PATCH] Prune duplicated test code --- CHANGES.txt | 3 +- plone/app/discussion/tests/test_comment.py | 129 --------------------- 2 files changed, 2 insertions(+), 130 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b03037b..c3c9969 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,8 @@ Changelog 2.1.7 (unreleased) ------------------ -- Nothing changed yet. +- Prune duplicated test code. + [pjstevns] 2.1.6 (2012-05-30) diff --git a/plone/app/discussion/tests/test_comment.py b/plone/app/discussion/tests/test_comment.py index 309086a..980dfd5 100644 --- a/plone/app/discussion/tests/test_comment.py +++ b/plone/app/discussion/tests/test_comment.py @@ -271,135 +271,6 @@ class CommentTest(unittest.TestCase): View.__call__(view) self.assertEqual(self.request.response.status, 302) - def test_workflow(self): - """Basic test for the 'comment_review_workflow' - """ - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('comment_review_workflow,')) - - conversation = IConversation(self.portal.doc1) - comment1 = createObject('plone.Comment') - new_comment1_id = conversation.addComment(comment1) - - comment = conversation[new_comment1_id] - - # Make sure comments use the 'comment_review_workflow' - chain = self.portal.portal_workflow.getChainFor(comment) - self.assertEqual(('comment_review_workflow',), chain) - - # Ensure the initial state was entered and recorded - self.assertEqual(1, - len(comment.workflow_history['comment_review_workflow'])) - self.assertEqual(None, - comment.workflow_history['comment_review_workflow'][0]['action']) - self.assertEqual('pending', - self.portal.portal_workflow.getInfoFor(comment, 'review_state')) - - def test_fti(self): - # test that we can look up an FTI for Discussion Item - - self.assertTrue("Discussion Item" in - self.portal.portal_types.objectIds()) - - comment1 = createObject('plone.Comment') - - fti = self.portal.portal_types.getTypeInfo(comment1) - self.assertEqual('Discussion Item', fti.getTypeInfo(comment1).getId()) - - def test_view(self): - # make sure that the comment view is there and redirects to the right - # URL - - # Create a conversation. In this case we doesn't assign it to an - # object, as we just want to check the Conversation object API. - conversation = IConversation(self.portal.doc1) - - # Create a comment - comment1 = createObject('plone.Comment') - comment1.text = 'Comment text' - - # Add comment to the conversation - new_comment1_id = conversation.addComment(comment1) - - comment = self.portal.doc1.restrictedTraverse( - '++conversation++default/%s' % new_comment1_id) - - # make sure the view is there - self.assertTrue(getMultiAdapter((comment, self.request), - name='view')) - - # make sure the HTTP redirect (status code 302) works when a comment - # is called directly - view = View(comment, self.request) - View.__call__(view) - - - - def test_workflow(self): - """Basic test for the 'comment_review_workflow' - """ - self.portal.portal_workflow.setChainForPortalTypes( - ('Discussion Item',), - ('comment_review_workflow,')) - - conversation = IConversation(self.portal.doc1) - comment1 = createObject('plone.Comment') - new_comment1_id = conversation.addComment(comment1) - - comment = conversation[new_comment1_id] - - # Make sure comments use the 'comment_review_workflow' - chain = self.portal.portal_workflow.getChainFor(comment) - self.assertEqual(('comment_review_workflow',), chain) - - # Ensure the initial state was entered and recorded - self.assertEqual(1, - len(comment.workflow_history['comment_review_workflow'])) - self.assertEqual(None, - comment.workflow_history['comment_review_workflow'][0]['action']) - self.assertEqual('pending', - self.portal.portal_workflow.getInfoFor(comment, 'review_state')) - - def test_fti(self): - # test that we can look up an FTI for Discussion Item - - self.assertTrue("Discussion Item" in - self.portal.portal_types.objectIds()) - - comment1 = createObject('plone.Comment') - - fti = self.portal.portal_types.getTypeInfo(comment1) - self.assertEqual('Discussion Item', fti.getTypeInfo(comment1).getId()) - - def test_view(self): - # make sure that the comment view is there and redirects to the right - # URL - - # Create a conversation. In this case we doesn't assign it to an - # object, as we just want to check the Conversation object API. - conversation = IConversation(self.portal.doc1) - - # Create a comment - comment1 = createObject('plone.Comment') - comment1.text = 'Comment text' - - # Add comment to the conversation - new_comment1_id = conversation.addComment(comment1) - - comment = self.portal.doc1.restrictedTraverse( - '++conversation++default/%s' % new_comment1_id) - - # make sure the view is there - self.assertTrue(getMultiAdapter((comment, self.request), - name='view')) - - # make sure the HTTP redirect (status code 302) works when a comment - # is called directly - view = View(comment, self.request) - View.__call__(view) - self.assertEqual(self.request.response.status, 302) - class RepliesTest(unittest.TestCase):