Run ConversationTest for dexterity types only if dexterity is installed.
This commit is contained in:
parent
103c7323e7
commit
528e1a1434
@ -24,6 +24,12 @@ from plone.app.discussion.interfaces import IComment
|
|||||||
from plone.app.discussion.interfaces import IReplies
|
from plone.app.discussion.interfaces import IReplies
|
||||||
from plone.app.discussion.interfaces import IDiscussionSettings
|
from plone.app.discussion.interfaces import IDiscussionSettings
|
||||||
|
|
||||||
|
try:
|
||||||
|
import plone.dexterity
|
||||||
|
DEXTERITY = True
|
||||||
|
except:
|
||||||
|
DEXTERITY = False
|
||||||
|
|
||||||
|
|
||||||
class ConversationTest(unittest.TestCase):
|
class ConversationTest(unittest.TestCase):
|
||||||
|
|
||||||
@ -728,11 +734,11 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
|
|||||||
|
|
||||||
typetool = self.portal.portal_types
|
typetool = self.portal.portal_types
|
||||||
typetool.constructContent('Document', self.portal, 'doc1')
|
typetool.constructContent('Document', self.portal, 'doc1')
|
||||||
|
if DEXTERITY:
|
||||||
from plone.dexterity.interfaces import IDexterityContent
|
from plone.dexterity.interfaces import IDexterityContent
|
||||||
interface.alsoProvides(
|
interface.alsoProvides(
|
||||||
self.portal.doc1,
|
self.portal.doc1,
|
||||||
IDexterityContent)
|
IDexterityContent)
|
||||||
|
|
||||||
def _makeOne(self, *args, **kw):
|
def _makeOne(self, *args, **kw):
|
||||||
return self.portal.doc1.restrictedTraverse('@@conversation_view')
|
return self.portal.doc1.restrictedTraverse('@@conversation_view')
|
||||||
@ -748,33 +754,38 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
|
|||||||
document_fti.manage_changeProperties(allow_discussion=allow_discussion)
|
document_fti.manage_changeProperties(allow_discussion=allow_discussion)
|
||||||
|
|
||||||
def test_conversation_is_not_enabled_by_default(self):
|
def test_conversation_is_not_enabled_by_default(self):
|
||||||
conversation = self._makeOne(self.portal.doc1)
|
if DEXTERITY:
|
||||||
self.assertFalse(conversation.enabled())
|
conversation = self._makeOne(self.portal.doc1)
|
||||||
|
self.assertFalse(conversation.enabled())
|
||||||
|
|
||||||
def test_conversation_is_not_enabled_by_default_on_portal_type(self):
|
def test_conversation_is_not_enabled_by_default_on_portal_type(self):
|
||||||
self._globally_enable_discussion(True)
|
if DEXTERITY:
|
||||||
conversation = self._makeOne(self.portal.doc1)
|
self._globally_enable_discussion(True)
|
||||||
self.assertFalse(conversation.enabled())
|
conversation = self._makeOne(self.portal.doc1)
|
||||||
|
self.assertFalse(conversation.enabled())
|
||||||
|
|
||||||
def test_conversation_needs_to_be_enabled_globally_and_for_type(self):
|
def test_conversation_needs_to_be_enabled_globally_and_for_type(self):
|
||||||
self._globally_enable_discussion(True)
|
if DEXTERITY:
|
||||||
self._enable_discussion_on_portal_type('Document', True)
|
self._globally_enable_discussion(True)
|
||||||
conversation = self._makeOne(self.portal.doc1)
|
self._enable_discussion_on_portal_type('Document', True)
|
||||||
self.assertTrue(conversation.enabled())
|
conversation = self._makeOne(self.portal.doc1)
|
||||||
|
self.assertTrue(conversation.enabled())
|
||||||
|
|
||||||
def test_disable_discussion(self):
|
def test_disable_discussion(self):
|
||||||
self._globally_enable_discussion(True)
|
if DEXTERITY:
|
||||||
self._enable_discussion_on_portal_type('Document', True)
|
self._globally_enable_discussion(True)
|
||||||
self.portal.doc1.allow_discussion = False
|
self._enable_discussion_on_portal_type('Document', True)
|
||||||
conversation = self._makeOne(self.portal.doc1)
|
self.portal.doc1.allow_discussion = False
|
||||||
self.assertFalse(conversation.enabled())
|
conversation = self._makeOne(self.portal.doc1)
|
||||||
|
self.assertFalse(conversation.enabled())
|
||||||
|
|
||||||
def test_enable_discussion(self):
|
def test_enable_discussion(self):
|
||||||
self._globally_enable_discussion(True)
|
if DEXTERITY:
|
||||||
self._enable_discussion_on_portal_type('Document', True)
|
self._globally_enable_discussion(True)
|
||||||
self.portal.doc1.allow_discussion = True
|
self._enable_discussion_on_portal_type('Document', True)
|
||||||
conversation = self._makeOne(self.portal.doc1)
|
self.portal.doc1.allow_discussion = True
|
||||||
self.assertTrue(conversation.enabled())
|
conversation = self._makeOne(self.portal.doc1)
|
||||||
|
self.assertTrue(conversation.enabled())
|
||||||
|
|
||||||
|
|
||||||
class RepliesTest(unittest.TestCase):
|
class RepliesTest(unittest.TestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user