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 IDiscussionSettings
|
||||
|
||||
try:
|
||||
import plone.dexterity
|
||||
DEXTERITY = True
|
||||
except:
|
||||
DEXTERITY = False
|
||||
|
||||
|
||||
class ConversationTest(unittest.TestCase):
|
||||
|
||||
@ -728,7 +734,7 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
|
||||
|
||||
typetool = self.portal.portal_types
|
||||
typetool.constructContent('Document', self.portal, 'doc1')
|
||||
|
||||
if DEXTERITY:
|
||||
from plone.dexterity.interfaces import IDexterityContent
|
||||
interface.alsoProvides(
|
||||
self.portal.doc1,
|
||||
@ -748,21 +754,25 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
|
||||
document_fti.manage_changeProperties(allow_discussion=allow_discussion)
|
||||
|
||||
def test_conversation_is_not_enabled_by_default(self):
|
||||
if DEXTERITY:
|
||||
conversation = self._makeOne(self.portal.doc1)
|
||||
self.assertFalse(conversation.enabled())
|
||||
|
||||
def test_conversation_is_not_enabled_by_default_on_portal_type(self):
|
||||
if DEXTERITY:
|
||||
self._globally_enable_discussion(True)
|
||||
conversation = self._makeOne(self.portal.doc1)
|
||||
self.assertFalse(conversation.enabled())
|
||||
|
||||
def test_conversation_needs_to_be_enabled_globally_and_for_type(self):
|
||||
if DEXTERITY:
|
||||
self._globally_enable_discussion(True)
|
||||
self._enable_discussion_on_portal_type('Document', True)
|
||||
conversation = self._makeOne(self.portal.doc1)
|
||||
self.assertTrue(conversation.enabled())
|
||||
|
||||
def test_disable_discussion(self):
|
||||
if DEXTERITY:
|
||||
self._globally_enable_discussion(True)
|
||||
self._enable_discussion_on_portal_type('Document', True)
|
||||
self.portal.doc1.allow_discussion = False
|
||||
@ -770,6 +780,7 @@ class ConversationEnabledForDexterityTypesTest(unittest.TestCase):
|
||||
self.assertFalse(conversation.enabled())
|
||||
|
||||
def test_enable_discussion(self):
|
||||
if DEXTERITY:
|
||||
self._globally_enable_discussion(True)
|
||||
self._enable_discussion_on_portal_type('Document', True)
|
||||
self.portal.doc1.allow_discussion = True
|
||||
|
Loading…
Reference in New Issue
Block a user