Skip to content

Commit

Permalink
Make sure NameChooserTest still works if ATContentTypes is installed …
Browse files Browse the repository at this point in the history
…and a 'Document' type is already present.
  • Loading branch information
tisto committed Sep 24, 2013
1 parent 446ab64 commit 8e115b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 0 additions & 4 deletions plone/app/content/testing.py
Expand Up @@ -4,7 +4,6 @@
from plone.app.testing import PloneSandboxLayer
from plone.app.testing import IntegrationTesting
from plone.app.testing import FunctionalTesting
from plone.dexterity.fti import DexterityFTI
from zope.configuration import xmlconfig


Expand Down Expand Up @@ -62,9 +61,6 @@ def setUpPloneSite(self, portal):
[],
)

fti = DexterityFTI('Document')
portal.portal_types._setObject('Document', fti)

PLONE_APP_CONTENT_FIXTURE = PloneAppContent()
PLONE_APP_CONTENT_INTEGRATION_TESTING = IntegrationTesting(
bases=(PLONE_APP_CONTENT_FIXTURE,),
Expand Down
9 changes: 8 additions & 1 deletion plone/app/content/tests/test_namechooser_unit.py
@@ -1,18 +1,25 @@
import unittest2 as unittest
from Products.CMFCore.utils import getToolByName
from plone.app.content.testing import PLONE_APP_CONTENT_INTEGRATION_TESTING
from plone.app.testing import TEST_USER_ID, TEST_USER_NAME
from plone.app.testing import setRoles, login
import transaction
from plone.app.content.namechooser import ATTEMPTS
from plone.dexterity.fti import DexterityFTI
from zope.container.interfaces import INameChooser

import unittest2 as unittest


class NameChooserTest(unittest.TestCase):

layer = PLONE_APP_CONTENT_INTEGRATION_TESTING

def setUp(self):
self.portal = self.layer['portal']
portal_types = getToolByName(self.portal, "portal_types")
if 'Document' not in portal_types.objectIds():
fti = DexterityFTI('Document')
portal_types._setObject('Document', fti)
setRoles(self.portal, TEST_USER_ID, ['Manager'])
login(self.portal, TEST_USER_NAME)

Expand Down

1 comment on commit 8e115b0

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing information:

Please sign in to comment.