From 8e56b99638f48170725a29425312ae6f3966aec8 Mon Sep 17 00:00:00 2001 From: vmaksymiv Date: Tue, 24 Sep 2013 08:14:05 +0000 Subject: [PATCH] added test acquisition chain for unwrapped object Conflicts: plone/app/discussion/tests/test_acquisition.py --- .../app/discussion/tests/test_acquisition.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plone/app/discussion/tests/test_acquisition.py b/plone/app/discussion/tests/test_acquisition.py index 31d5f81..4f4d01b 100644 --- a/plone/app/discussion/tests/test_acquisition.py +++ b/plone/app/discussion/tests/test_acquisition.py @@ -1,5 +1,8 @@ # -*- coding: utf-8 -*- -from Acquisition import aq_chain +from AccessControl.User import User # before SpecialUsers +from AccessControl.SpecialUsers import nobody as user_nobody +from AccessControl.PermissionRole import rolesForPermissionOn +from Acquisition import aq_chain, aq_base from plone.app.discussion.testing import \ PLONE_APP_DISCUSSION_INTEGRATION_TESTING from plone.app.discussion.interfaces import IConversation @@ -140,6 +143,25 @@ class DexterityAcquisitionTest(unittest.TestCase): for (index, item) in enumerate(dx_conversation_chain): self.assertEqual(item, dx_comment_chain[index + 1]) + def test_acquisition_base_object_chain(self): + """ The acquisition chain for the object without wrappers should return + list which contains only the object. + """ + + at_object_base_chain = aq_chain(aq_base(self.archetypes_object)) + dx_object_base_chain = aq_chain(aq_base(self.dexterity_object)) + + # Fails: acquisition chain has more than one object + self.assertTrue(len(at_object_base_chain) == 1) + self.assertTrue(len(dx_object_base_chain) == 1) + + at_comment_base_chain = aq_chain(aq_base(self.archetypes_comment)) + dx_comment_base_chain = aq_chain(aq_base(self.dexterity_comment)) + + # Fails: acquisition chain has more than one object + self.assertTrue(len(at_comment_base_chain) == 1) + self.assertTrue(len(dx_comment_base_chain) == 1) + def test_suite(): return unittest.defaultTestLoader.loadTestsFromName(__name__)