Skip to content

Commit

Permalink
Test against plone.app.contenttypes fixture instead of Archetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed May 7, 2018
1 parent b381f97 commit 4c1e05c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Bug fixes:
- Fix adapter lookup on Python 3.
[ale-rt]

- Test using plone.app.contenttypes instead of Archetypes.
[davisagli]

4.1.7 (2018-03-12)
------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<property name="global_allow">True</property>
<property name="filter_content_types">True</property>
<property name="allowed_content_types"/>
<property name="default_view">document_view</property>
<property name="default_view">index_html</property>
<property name="view_methods">
<element value="document_view"/>
<element value="custom_view"/>
Expand Down
29 changes: 21 additions & 8 deletions Products/CMFDynamicViewFTI/tests/CMFDVFTITestCase.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# -*- coding: utf-8 -*-
#
# CMFDVFTITestCase
#
from plone.app import testing
from plone.app.testing import bbb
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
from plone.app.testing.bbb import PloneTestCase
from Products.CMFCore.interfaces import ISiteRoot
from Products.CMFPlone.utils import _createObjectByType
from Products.GenericSetup import EXTENSION, profile_registry
import transaction
import unittest


class PloneTestCaseFixture(bbb.PloneTestCaseFixture):
class CMFDynamicViewFTIFixture(PloneSandboxLayer):

defaultBases = (bbb.PTC_FIXTURE, )
defaultBases = (PLONE_FIXTURE, )

def setUpZope(self, app, configurationContext):
profile_registry.registerProfile(
Expand All @@ -29,17 +31,28 @@ def setUpZope(self, app, configurationContext):
def setUpPloneSite(self, portal):
self.applyProfile(portal, 'CMFDynamicViewFTI:CMFDVFTI_sampletypes')


def tearDownZope(self, app):
pass

CDV_FIXTURE = PloneTestCaseFixture()
CDV_FIXTURE = CMFDynamicViewFTIFixture()
CDV_FUNCTIONAL_TESTING = testing.FunctionalTesting(
bases=(CDV_FIXTURE, ), name='CMFDynamicViewFTI Testing:Functional')


class CMFDVFTITestCase(bbb.PloneTestCase):
class CMFDVFTITestCase(PloneTestCase):
"""This is a stub now, but in case you want to try
something fancy on Your Branch (tm), put it here.
"""

def setUp(self):
"""Set up before each test."""
self.beforeSetUp()
self.app = self.layer['app']
self.portal = self.layer['portal']
_createObjectByType('DynFolder', self.portal, id='folder')
self.folder = self.portal.folder
transaction.commit()
self.afterSetUp()

layer = CDV_FUNCTIONAL_TESTING
8 changes: 2 additions & 6 deletions Products/CMFDynamicViewFTI/tests/test_fti.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
from plone.app.testing import TEST_USER_NAME
from plone.app.testing import TEST_USER_PASSWORD
from Products.Archetypes.atapi import StringField
from Products.CMFCore.interfaces import ITypeInformation
from Products.CMFCore.utils import getToolByName
from Products.CMFDynamicViewFTI.fti import DynamicViewTypeInformation
Expand Down Expand Up @@ -215,17 +214,14 @@ def afterSetUp(self):
def test_FolderEmptyLayoutBug(self):
response = self.publish(
self.dynfolder_path + '/view',
basic=self.basic
basic=self.basic,
)
self.assertEqual(response.getStatus(), 200)

def test_DocumentEmptyLayoutBug(self):
# add a text field to dyndocument which is not present
# but needed for the standard view
self.dyndocument.Schema().addField(StringField('text'))
response = self.publish(
self.dyndocument_path + '/view',
basic=self.basic
basic=self.basic,
)
self.assertEqual(response.getStatus(), 200)

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
'plone.app.contentmenu',
'zope.publisher',
'plone.app.testing >= 4.2.5',
'Products.Archetypes',
]
),
install_requires=[
Expand Down

0 comments on commit 4c1e05c

Please sign in to comment.