Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add test infrastructure, update buildout.cfg, add squinx docs

  • Loading branch information...
commit 812c2043ea740ade2812ff4b4374f5f6243b577c 1 parent 9d1be50
@MrTango MrTango authored
View
4 .gitignore
@@ -13,7 +13,11 @@
.installed.cfg
develop-eggs
eggs
+var
+parts
bin
*.egg-info
dist
build
+docs/_build
+docs/conf.py
View
6 Products/CMFContentPanels/config.py
@@ -7,8 +7,8 @@
try:
# Plone 4 and higher
import plone.app.upgrade
- PLONE_VERSION = 4
-except ImportError:
+ PLONE_VERSION = 4
+except ImportError:
PLONE_VERSION = 3
if PLONE_VERSION == 3:
@@ -18,7 +18,7 @@
PLONE_VERSION = 3
except ImportError:
PLONE_VERSION = 2
-
+
ADD_CONTENT_PERMISSION = AddPortalContent
PROJECTNAME = 'CMFContentPanels'
SKINS_DIR = 'skins'
View
77 Products/CMFContentPanels/testing.py
@@ -0,0 +1,77 @@
+from Products.CMFCore.utils import getToolByName
+
+from plone.app.testing import PloneSandboxLayer
+from plone.app.testing import applyProfile
+from plone.app.testing import PLONE_FIXTURE
+from plone.app.testing import IntegrationTesting
+from plone.app.testing import FunctionalTesting
+
+from plone.testing import z2
+
+from zope.configuration import xmlconfig
+
+class CMFContentPanels(PloneSandboxLayer):
+ defaultBases = (PLONE_FIXTURE,)
+
+ USER_NAME = 'johndoe'
+ USER_PASSWORD = 'secret'
+ MEMBER_NAME = 'janedoe'
+ MEMBER_PASSWORD = 'secret'
+ USER_WITH_FULLNAME_NAME = 'freddie'
+ USER_WITH_FULLNAME_FULLNAME = 'Freddie Mercury'
+ USER_WITH_FULLNAME_PASSWORD = 'secret'
+ MANAGER_USER_NAME = 'manager'
+ MANAGER_USER_PASSWORD = 'secret'
+
+ def setUpZope(self, app, configurationContext):
+ # Load ZCML
+ import Products.CMFContentPanels
+ xmlconfig.file('configure.zcml',
+ Products.CMFContentPanels,
+ context=configurationContext)
+ with z2.zopeApp() as app:
+ z2.installProduct(app, 'Products.CMFContentPanels')
+
+ def setUpPloneSite(self, portal):
+ # Install into Plone site using portal_setup
+ applyProfile(portal, 'Products.CMFContentPanels:default')
+ # Creates some users
+ acl_users = getToolByName(portal, 'acl_users')
+ acl_users.userFolderAddUser(
+ self.USER_NAME,
+ self.USER_PASSWORD,
+ [],
+ [],
+ )
+ acl_users.userFolderAddUser(
+ self.MEMBER_NAME,
+ self.MEMBER_PASSWORD,
+ ['Member'],
+ [],
+ )
+ acl_users.userFolderAddUser(
+ self.USER_WITH_FULLNAME_NAME,
+ self.USER_WITH_FULLNAME_PASSWORD,
+ ['Member'],
+ [],
+ )
+ mtool = getToolByName(portal, 'portal_membership', None)
+ mtool.addMember(self.USER_WITH_FULLNAME_NAME, self.USER_WITH_FULLNAME_NAME, ['Member'], [])
+ mtool.getMemberById(self.USER_WITH_FULLNAME_NAME).setMemberProperties({"fullname":
+ self.USER_WITH_FULLNAME_FULLNAME})
+
+ acl_users.userFolderAddUser(
+ self.MANAGER_USER_NAME,
+ self.MANAGER_USER_PASSWORD,
+ ['Manager'],
+ [],
+ )
+
+CMFCONTENTPANELS_FIXTURE = CMFContentPanels()
+CMFCONTENTPANELS_INTEGRATION_TESTING = IntegrationTesting(
+ bases=(CMFCONTENTPANELS_FIXTURE,),
+ name="CMFContentPanels:Integration")
+CMFCONTENTPANELS_FUNCTIONAL_TESTING = FunctionalTesting(
+ bases=(CMFCONTENTPANELS_FIXTURE,),
+ name="CMFContentPanels:Functional")
+
View
1  Products/CMFContentPanels/tests/__init__.py
@@ -0,0 +1 @@
+#
View
37 Products/CMFContentPanels/tests/test_contentpanel.py
@@ -0,0 +1,37 @@
+import unittest2 as unittest
+from Products.CMFCore.utils import getToolByName
+from plone.app.testing import TEST_USER_ID, TEST_USER_NAME, setRoles, login
+from Products.CMFContentPanels.testing import CMFCONTENTPANELS_INTEGRATION_TESTING
+
+
+class ContentPanelTest(unittest.TestCase):
+
+ layer = CMFCONTENTPANELS_INTEGRATION_TESTING
+
+ def setUp(self):
+ self.portal = self.layer["portal"]
+ self.request = self.layer["request"]
+
+ setRoles(self.portal, TEST_USER_ID, ['Manager'])
+ login(self.portal, TEST_USER_NAME)
+ self.portal.invokeFactory(id='doc1',
+ title='Document 1',
+ type_name='Document')
+ self.catalog = getToolByName(self.portal, 'portal_catalog')
+ self.document_brain = self.catalog.searchResults(
+ portal_type = 'Document')[0]
+
+ def test_factory(self):
+ contentpanels1_id = self.portal.invokeFactory(id='cp1',
+ title='Content Panel 1',
+ type_name='ContentPanels')
+ self.assertEqual(contentpanels1_id, 'cp1')
+ self.assertIn('cp1', self.portal.objectIds())
+ self.assertEqual(self.portal[contentpanels1_id].portal_type, 'ContentPanels')
+
+
+
+
+
+def test_suite():
+ return unittest.defaultTestLoader.loadTestsFromName(__name__)
View
84 buildout.cfg
@@ -1,7 +1,91 @@
[buildout]
+extends =
+ http://svn.plone.org/svn/collective/buildout/plonetest/plone-4.1.x.cfg
+
+package-name = Products.CMFContentPanels
+package-directory = Products/CMFContentPanels
+
+extensions = buildout.eggtractor
+tractor-src-directory =
+ .
+ src
+
parts +=
+ omelette
releaser
+ test
+# xmltest
+ coverage
+ report
+ zopepy
+ sphinxbuilder
+ sphinxupload
+
+
+[instance]
+eggs +=
+ PILwoTK
+ Products.PdbDebugMode
+ Products.PrintingMailHost
+ Sphinx
+ Sphinx-PyPI-upload
+ repoze.sphinx.autointerface
+ iw.debug
[releaser]
recipe = zc.recipe.egg
eggs = zest.releaser
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = ${buildout:package-name} [test]
+defaults = ['--auto-color', '--auto-progress']
+
+[coverage]
+recipe = zc.recipe.egg
+eggs = coverage
+initialization =
+ include = '--source=${buildout:directory}/src'
+ sys.argv = sys.argv[:] + ['run', include, 'bin/test', '--all']
+
+[report]
+recipe = zc.recipe.egg
+eggs = coverage
+scripts = coverage=report
+initialization =
+ sys.argv = sys.argv[:] + ['html', '-i']
+
+[omelette]
+recipe = collective.recipe.omelette
+eggs = ${instance:eggs}
+packages = ${instance:location}/lib/python ./
+
+#[xmltest]
+#recipe = collective.xmltestreport
+#eggs = ${buildout:package-name} [test]
+#defaults = ['--auto-color', '--auto-progress']
+
+[zopepy]
+recipe = zc.recipe.egg
+eggs = ${instance:eggs}
+interpreter = zopepy
+scripts = zopepy
+
+[sphinxbuilder]
+recipe = collective.recipe.sphinxbuilder
+interpreter = ${buildout:directory}/bin/zopepy
+source = ${buildout:directory}/docs
+build = ${buildout:directory}/docs/_build
+outputs =
+ html
+ latex
+ pdf
+
+[sphinxupload]
+recipe = collective.recipe.template
+input = inline:
+ #!/bin/sh
+ bin/zopepy setup.py upload_sphinx
+output = ${buildout:directory}/bin/sphinxupload
+mode = 755
+
View
20 docs/index.txt
@@ -0,0 +1,20 @@
+.. Products.CMFContentPanels documentation master file, created by
+ sphinx-quickstart on Tue Nov 22 21:33:11 2011.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to Products.CMFContentPanels's documentation!
+=====================================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
View
2  setup.cfg
@@ -1,3 +1,3 @@
[egg_info]
-tag_build = dev
+#tag_build = dev
tag_svn_revision = false
View
61 setup.py
@@ -1,32 +1,41 @@
from setuptools import setup, find_packages
import os
-version = open(os.path.join("Products", "CMFContentPanels", "version.txt")).read().strip()
+version = '2.6a11dev'
-setup(name='Products.CMFContentPanels',
- version=version,
- description="CMFContentPanels is a plone portlets product to build composite pages",
- long_description=open(os.path.join("Products", "CMFContentPanels", "README.txt")).read().decode('UTF8').encode('ASCII', 'replace'),
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
+setup(
+ name='Products.CMFContentPanels',
+ version=version,
+ description="CMFContentPanels is a plone portlets product to build composite pages",
+ long_description=open(
+ os.path.join("Products", "CMFContentPanels", "README.txt")
+ ).read().decode('UTF8').encode('ASCII', 'replace'),
+# Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
"Programming Language :: Python",
"Framework :: Plone"
- ],
- keywords='plone web composite_pages CMFContentPanels',
- author='Erico Andrei',
- author_email='erico@simplesconsultoria.com.br',
- url='http://svn.plone.org/svn/collective/Products.CMFContentPanels/',
- license='GPL',
- packages=find_packages(exclude=['ez_setup']),
- namespace_packages=['Products'],
- include_package_data=True,
- zip_safe=False,
- install_requires=[
- 'setuptools',
- # -*- Extra requirements: -*-,
- 'feedparser',
- ],
- entry_points="""
- # -*- Entry points: -*-
- """,
- )
+ ],
+ keywords='plone web composite_pages CMFContentPanels',
+ maintainer='Erico Andrei, Maik Derstappen <maik.derstappen@inqbus.de>',
+ author='Erico Andrei',
+ author_email='erico@simplesconsultoria.com.br',
+ url='http://github.com/collective/Products.CMFContentPanels',
+ license='GPL',
+ packages=find_packages(exclude=['ez_setup']),
+ namespace_packages=['Products'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ # -*- Extra requirements: -*-,
+ 'feedparser',
+ ],
+ extras_require = {
+ 'test': [
+ 'plone.app.testing',
+ ]
+ },
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+)
Please sign in to comment.
Something went wrong with that request. Please try again.