def installWithinPortal(): # Import to install the sample types from Products.Archetypes.tests import attestcase installProducts() PloneTestCase.setupPloneSite(products=product_dependencies, extension_profiles=('Products.Archetypes:Archetypes_sampletypes',))
def test_04_addConnection(self,): self.failIf(PloneDbFormsManager.PloneDbFormsManager.addConnection.__doc__==None,"addConnection is not documented") PloneTestCase.installProduct('ZPsycopgDA') folder = self.folder pdfsmtest = self.getPdfsmTest() # doesn't add connection is connection_string is bad pdfsmtest.addConnection(connection_info="n'importe quoi",title="mon titre") self.failIf(hasattr(pdfsmtest,"connection")) # adds if connection_string is good pdfsmtest.addConnection(connection_info="dbname=cnb2 user=caron_test password=shsd54 host=138.102.22.9 port=5433",title="mon titre") self.failUnless(hasattr(pdfsmtest,"connection")) self.failUnless(pdfsmtest.connection.connection_string=="dbname=cnb2 user=caron_test password=shsd54 host=138.102.22.9 port=5433") self.failUnless(pdfsmtest.connection_info=="dbname=cnb2 user=caron_test password=shsd54 host=138.102.22.9 port=5433") pgfsmtest = self.getPgfsmTest() pgfsmtest.addConnection(connection_info="subventions",title="mon titre")
def setup_site(): setup_policyPloneSite() ptc.setupPloneSite(products=[\ # if we have csvreplicata, just say that a plone site can't live without it. 'csvreplicata', 'pgolf.policy'] )
def setUp(cls): ptc.installProduct('Maps') fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.realestatebroker) fiveconfigure.debug_mode = False ptc.installPackage('collective.realestatebroker')
def setUp(cls): """Set up additional products and ZCML required to test this product. """ #ztc.installProduct('RichDocument') ztc.installProduct('LinguaPlone') ztc.installProduct('PlacelessTranslationService') ztc.installPackage('slc.linguatools') ptc.setupPloneSite(products=[ 'LinguaPlone', 'slc.linguatools', 'Products.RichDocument', ]) # Load the ZCML configuration for this package and its dependencies # register the Browserlayer from slc.linguatools, so that our # schema-extensions using IBrowserLayerAwareExtender work browserlayerutils.register_layer(ILinguaToolsLayer, name='slc.linguatools') fiveconfigure.debug_mode = True import slc.linguatools import Products.LinguaPlone zcml.load_config('configure.zcml', slc.linguatools) import Products.LinguaPlone zcml.load_config('configure.zcml', Products.LinguaPlone) fiveconfigure.debug_mode = False SiteLayer.setUp()
def setUp(cls): ztc.installProduct('borg.project') ptc.setupPloneSite(products=( 'CMFPlacefulWorkflow', ), extension_profiles=( u'borg.project:default', )) fiveconfigure.debug_mode = True import borg.project zcml.load_config('configure.zcml', borg.project) import Products.CMFPlacefulWorkflow zcml.load_config('configure.zcml', Products.CMFPlacefulWorkflow) fiveconfigure.debug_mode = False # We need to tell the testing framework that these products # should be available. This can't happen until after we have loaded # the ZCML. Notice the extra package=True argument passed to # installProduct() - this tells it that these packages are *not* in the # Products namespace. ztc.installPackage('borg.localrole') ztc.installPackage('borg.project') SiteLayer.setUp()
def setUp(cls): ptc.setupPloneSite(products=['gfb.policy']) ztc.installProduct('ATVocabularyManager') ztc.installProduct('LinguaPlone') ztc.installProduct('TextIndexNG3') ztc.installProduct('ProxyIndex') ztc.installProduct('ATCountryWidget') SiteLayer.setUp()
def afterSetUp(self): # load zcml for this package and its dependencies fiveconfigure.debug_mode = True from collective import usernamelogger zcml.load_config('configure.zcml', package=usernamelogger) fiveconfigure.debug_mode = False # after which the required packages can be initialized ptc.installPackage('collective.usernamelogger', quiet=True)
def afterSetUp(self): PloneTestCase.installProduct('FSImportTool') self.pdf_latex_tool = getToolByName(self.portal, 'portal_pdflatex') # PloneTestCase already gives us a folder, so within that folder, # create a document and a collection to version. self.folder.invokeFactory('Document', 'doc') self.doc = self.folder.doc
def setup_eea_relations(): """Set up the additional products. """ fiveconfigure.debug_mode = True import eea.relations zcml.load_config("configure.zcml", eea.relations) fiveconfigure.debug_mode = False PloneTestCase.installPackage("eea.relations")
def setup_eeacontenttypes(): """ Setup eeacontenttypes """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.EEATemplatesService) fiveconfigure.debug_mode = False PloneTestCase.installPackage('collective.monkeypatcher') PloneTestCase.installPackage('collective.fastview')
def load_package_products(): # Install all (product-) dependencies, install them too for dependency in PRODUCT_DEPENDENCIES + DEPENDENCIES: ZopeTestCase.installProduct(dependency) ZopeTestCase.installProduct('membrane') ZopeTestCase.installProduct('FacultyStaffDirectory') PloneTestCase.setupPloneSite(products=PRODUCTS)
def setUp(cls): """Set up additional products and ZCML required to test this product. """ ptc.setupPloneSite() installProduct('CMFDiffTool') if HAS_AT_SCHEMA_EXTENDER: zcml.load_config('configure.zcml', schemaextender) PloneSite.setUp()
def setup_copernicus_contenttypes(): """Set up the package and its dependencies. """ fiveconfigure.debug_mode = True import land.copernicus.content zcml.load_config('configure.zcml', land.copernicus.content) fiveconfigure.debug_mode = False ptc.installPackage('land.copernicus.content')
def setup_eea_geotags(): """Set up the additional products. The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', eea.geotags) fiveconfigure.debug_mode = False PloneTestCase.installPackage('eea.alchemy') PloneTestCase.installPackage('eea.jquery')
def setup_depiction(): """ Setup """ fiveconfigure.debug_mode = True if P_VIDEO: zcml.load_config('test.zcml', p4a.video) zcml.load_config('overrides.zcml', eea.depiction) zcml.load_config('configure.zcml', eea.depiction) fiveconfigure.debug_mode = False if P_VIDEO: PloneTestCase.installPackage('p4a.video')
def setUp(cls): profile_registry.registerProfile('sample_types', 'Recurrence Sample Content Types', 'Extension profile including Archetypes sample content types', 'profiles/sample_types', 'plone.formwidget.recurrence', EXTENSION) fiveconfigure.debug_mode = True ptc.installPackage('plone.formwidget.recurrence', quiet=0) zcml.load_config('configure.zcml', plone.formwidget.recurrence) fiveconfigure.debug_mode = False
def preload_plone(conf): print "Preloading Plone ..." from Products.PloneTestCase.layer import PloneSite from Products.PloneTestCase import PloneTestCase as ptc ptc.setupPloneSite() # pre-setup Plone layer setup_layers={} testrunner.setup_layer(PloneSite, setup_layers) # delete the plone layer registration so that the testrunner # will re-run Plone layer setUp after deferred setups have # been registered by the associated tests. del setup_layers[PloneSite] return setup_layers
def setup_eeaploneadmin(): """ Setup EEA Plone Admin """ for dependency in DEPENDENCIES: PloneTestCase.installProduct(dependency) fiveconfigure.debug_mode = True #import Products.Five #import Products.FiveSite import valentine.linguaflow zcml.load_config('configure.zcml', valentine.linguaflow) fiveconfigure.debug_mode = False
def setup_product(): PloneTestCase.installPackage('plone.browserlayer', quiet=1) fiveconfigure.debug_mode = True import Products.LinguaPlone.tests zcml.load_config('configure.zcml', Products.LinguaPlone.tests) fiveconfigure.debug_mode = False profile_registry.registerProfile('LinguaPlone_tests', 'LinguaPlone test content types', 'Extension profile including dummy types to test LinguaPlone', 'profiles/test_types', 'Products.LinguaPlone', EXTENSION)
def setUp(cls): PRODUCTS = ['actionbar.panel', ] ptc.setupPloneSite(products=PRODUCTS) fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', actionbar.panel) fiveconfigure.debug_mode = False browserlayer.utils.register_layer( IActionbarPanelLayer, name='actionbar.panel') component.provideAdapter(instanceSchemaFactory) SiteLayer.setUp()
def setUp(cls): """ Set up the additional products required """ PRODUCTS = ["plonetheme.nuplone"] ptc.setupPloneSite(products=PRODUCTS) fiveconfigure.debug_mode = True import plonetheme.nuplone zcml.load_config("meta.zcml", Products.Five) zcml.load_config("configure.zcml", Products.statusmessages) zcml.load_config("configure.zcml", plonetheme.nuplone) fiveconfigure.debug_mode = False SiteLayer.setUp()
def setup_eea_signals(): """ Setup """ fiveconfigure.debug_mode = True import Products.Five import eea.signals zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.Five) zcml.load_config('configure.zcml', eea.signals) fiveconfigure.debug_mode = False PloneTestCase.installProduct('Five') for i in PRODUCTS: PloneTestCase.installProduct(i)
def setUp(cls): """Set up additional products and ZCML required to test this product. """ ztc.installPackage('slc.googlesearch') ptc.setupPloneSite(products=['slc.googlesearch']) # Load the ZCML configuration for this package and its dependencies fiveconfigure.debug_mode = True import slc.googlesearch zcml.load_config('configure.zcml', slc.googlesearch) fiveconfigure.debug_mode = False SiteLayer.setUp()
def setup_eea_sitestructurediff(): """ Setup EEA Sitestructurediff """ fiveconfigure.debug_mode = True import Products.Five import eea.sitestructurediff import valentine.linguaflow zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', eea.sitestructurediff) zcml.load_config('configure.zcml', valentine.linguaflow) fiveconfigure.debug_mode = False #ptc.installProduct('PloneLanguageTool') ptc.installProduct('LinguaPlone')
def setup_eea_faceted_tool(): """Set up the additional products. The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. """ fiveconfigure.debug_mode = True import Products.Five zcml.load_config('meta.zcml', Products.Five) import eea.faceted.tool zcml.load_config('configure.zcml', eea.faceted.tool) fiveconfigure.debug_mode = False ptc.installProduct('Five')
def setUp(cls): import osha.status zcml.load_config('configure.zcml', osha.status) import osha.theme zcml.load_config('configure.zcml', osha.theme) import textindexng zcml.load_config('configure.zcml', textindexng) import slc.clicksearch zcml.load_config('configure.zcml', slc.clicksearch) import slc.xliff zcml.load_config('configure.zcml', slc.xliff) fiveconfigure.debug_mode = False ztc.installPackage('osha.status', quiet=True) ptc.setupPloneSite(products=[], extension_profiles=['osha.theme:default']) SiteLayer.setUp()
def setUp(cls): """ Set up the additional products required for the DubletteFinder. """ PRODUCTS = [ 'collective.zipfiletransport', ] ptc.setupPloneSite(products=PRODUCTS) fiveconfigure.debug_mode = True import collective.zipfiletransport zcml.load_config('configure.zcml', collective.zipfiletransport) fiveconfigure.debug_mode = False component.provideAdapter(instanceSchemaFactory) SiteLayer.setUp()
def setUp(cls): """ Set up the additional products required for the DubletteFinder. """ PRODUCTS = [ 'slc.stickystatusmessages', ] ptc.setupPloneSite(products=PRODUCTS) fiveconfigure.debug_mode = True import slc.stickystatusmessages zcml.load_config('configure.zcml', slc.stickystatusmessages) fiveconfigure.debug_mode = False component.provideAdapter(instanceSchemaFactory) SiteLayer.setUp()
def setup_plonegazette(): """ Setup """ fiveconfigure.debug_mode = True import Products.Five import Products.FiveSite import Products.PloneGazette zcml.load_config('meta.zcml', Products.Five) zcml.load_config('configure.zcml', Products.Five) zcml.load_config('configure.zcml', Products.FiveSite) zcml.load_config('configure.zcml', Products.PloneGazette) fiveconfigure.debug_mode = False PloneTestCase.installProduct('Five') for i in PRODUCTS: PloneTestCase.installProduct(i)
@onsetup def setup_eea_geotags(): """Set up the additional products. The @onsetup decorator causes the execution of this body to be deferred until the setup of the Plone site testing layer. """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', eea.geotags) fiveconfigure.debug_mode = False PloneTestCase.installPackage('eea.alchemy') PloneTestCase.installPackage('eea.jquery') PloneTestCase.installPackage('eea.geolocation') setup_eea_geotags() PloneTestCase.setupPloneSite(extension_profiles=('eea.geotags:default', 'eea.geotags:demo', 'eea.geolocation:default')) class EEAGeotagsTestCase(PloneTestCase.PloneTestCase): """ Base class for integration tests for the 'EEA Geotags' product. """ class EEAGeotagsFunctionalTestCase(PloneTestCase.FunctionalTestCase, EEAGeotagsTestCase): """ Base class for functional integration tests for the 'EEA Geotags' product. """
# This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('redomino.tokenroleform') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['redomino.tokenroleform']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """ def afterSetUp(self):
import unittest from zope.testing import doctestunit from zope.component import testing from Testing import ZopeTestCase as ztc from Products.Five import zcml from Products.Five import fiveconfigure from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite # Set up a Plone site, and apply our custom extension profile PROFILES = ('Products.MathEditor:default',) ptc.setupPloneSite(extension_profiles=PROFILES) import Products.MathEditor class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.MathEditor) ztc.installPackage('Products.MathEditor') fiveconfigure.debug_mode = False @classmethod def tearDown(cls): pass
import doctest import unittest from Testing import ZopeTestCase as ztc from Products.Five import zcml from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite from Products.PloneTestCase.layer import onsetup import collective.dexterity_class OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \ doctest.ELLIPSIS ptc.setupPloneSite(products=['collective.dexterity_class']) class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): zcml.load_config('configure.zcml', collective.dexterity_class) @classmethod def tearDown(cls): pass def test_suite(): return unittest.TestSuite([
from Products.PloneTestCase import PloneTestCase as ptc from Products.ShibbolethPermissions.tests.utils import addShibbolethPermissions ptc.setupPloneSite() ptc.installProduct('ShibbolethPermissions') class ShibPermTestCase(ptc.PloneTestCase): """ A base class for ShibbolethPermissions tests """ class ShibPermFunctionalTestCase(ptc.FunctionalTestCase): """ A base class for ShibbolethPermissions functional tests """ def afterSetUp(self): addShibbolethPermissions(self.portal) # EOF
import doctest import unittest from Testing import ZopeTestCase as ztc from Products.Five import zcml from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite from Products.PloneTestCase.layer import onsetup import nnsh.behavior OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \ doctest.ELLIPSIS ptc.setupPloneSite(products=['nnsh.behavior']) class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): zcml.load_config('configure.zcml', nnsh.behavior) @classmethod def tearDown(cls): pass
ZopeTestCase.installProduct('CMFQuickInstallerTool', quiet=1) ZopeTestCase.installProduct('CMFFormController', quiet=1) ZopeTestCase.installProduct('GroupUserFolder', quiet=1) ZopeTestCase.installProduct('ZCTextIndex', quiet=1) ZopeTestCase.installProduct('TextIndexNG2', quiet=1) ZopeTestCase.installProduct('SecureMailHost', quiet=1) ZopeTestCase.installProduct('CMFPlone') ZopeTestCase.installProduct('Archetypes') ZopeTestCase.installProduct('PortalTransforms', quiet=1) ZopeTestCase.installProduct('MimetypesRegistry', quiet=1) ZopeTestCase.installProduct('Poi') from Products.PloneTestCase import PloneTestCase from Products.CMFPlone.tests.utils import MockMailHost PloneTestCase.setupPloneSite(products=['Poi']) def rich_text(original): return RichTextValue(original, 'text/plain', 'text/html') class PoiTestCase(PloneTestCase.PloneTestCase): class Session(dict): def set(self, key, value): self[key] = value def _setup(self): PloneTestCase.PloneTestCase._setup(self) # Replace normal mailhost with mock mailhost self.portal._original_MailHost = self.portal.MailHost
from Testing import ZopeTestCase # Make the boring stuff load quietly ZopeTestCase.installProduct('SimpleAttachment') ZopeTestCase.installProduct('CMFPlacefulWorkflow') ZopeTestCase.installProduct('Ploneboard') from Products.PloneTestCase import PloneTestCase PloneTestCase.setupPloneSite(products=('SimpleAttachment', 'CMFPlacefulWorkflow', 'Ploneboard')) class PloneboardTestCase(PloneTestCase.PloneTestCase): class Session(dict): def set(self, key, value): self[key] = value def _setup(self): PloneTestCase.PloneTestCase._setup(self) self.app.REQUEST['SESSION'] = self.Session() class PloneboardFunctionalTestCase(PloneTestCase.FunctionalTestCase): class Session(dict): def set(self, key, value): self[key] = value def _setup(self): PloneTestCase.FunctionalTestCase._setup(self) self.app.REQUEST['SESSION'] = self.Session()
""" # Load the ZCML configuration for this package and its dependencies fiveconfigure.debug_mode = True import collective.portlet.relateditems zcml.load_config('configure.zcml', collective.portlet.relateditems) fiveconfigure.debug_mode = False # We need to tell the testing framework that these products # should be available. This can't happen until after we have loaded # the ZCML. ztc.installPackage('collective.portlet.relateditems') # The order here is important: We first call the deferred function and then # let PloneTestCase install it during Plone site setup setup_product() ptc.setupPloneSite(products=['collective.portlet.relateditems']) class TestCase(ptc.PloneTestCase): """Base class used for test cases """ class FunctionalTestCase(ptc.FunctionalTestCase): """Test case class used for functional (doc-)tests """
# instead of installProduct(). # This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('tm.xml2table') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['tm.xml2table']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """
# which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # # ztc.installPackage('borg.localrole') # ztc.installPackage('collective.listjs') # The order here is important: We first call the (deferred) function which # installs the products we need for this product. Then, we let PloneTestCase # set up this product on installation. setup_product() ptc.setupPloneSite(products=['collective.listjs']) class ExampleTestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class ExampleFunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """
# This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('msd.oxtalks') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['msd.oxtalks']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """ def afterSetUp(self):
import doctest import unittest from Testing import ZopeTestCase as ztc from Products.Five import zcml from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite from Products.PloneTestCase.layer import onsetup import nva.chemiedp OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \ doctest.ELLIPSIS ptc.setupPloneSite(products=['nva.chemiedp']) class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): zcml.load_config('configure.zcml', nva.chemiedp) @classmethod def tearDown(cls): pass def test_suite(): return unittest.TestSuite([
import unittest from zope.testing import doctest from zope.component import testing from Testing.ZopeTestCase import FunctionalDocFileSuite import Products.PloneTestCase.layer from Products.PloneTestCase import PloneTestCase PloneTestCase.setupPloneSite() def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS unitsuite = unittest.TestSuite( (doctest.DocFileSuite('subtyping.txt', setUp=testing.setUp, tearDown=testing.tearDown, optionflags=flags), )) fsuite = unittest.TestSuite((FunctionalDocFileSuite( 'browser.txt', package='p4a.subtyper', optionflags=flags, test_class=PloneTestCase.FunctionalTestCase), )) fsuite.layer = Products.PloneTestCase.layer.PloneSite return unittest.TestSuite((unitsuite, fsuite))
import collective.cdn.core import collective.cdn.alternatehostname @onsetup def setup_product(): fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', collective.cdn.core) zcml.load_config('configure.zcml', collective.cdn.alternatehostname) fiveconfigure.debug_mode = False ztc.installPackage('collective.cdn.core') setup_product() ptc.setupPloneSite(products=[ 'collective.cdn.core', ]) class TestCase(FunctionalTestCase): def afterSetUp(self): super(TestCase, self).afterSetUp() self.browser = Browser() self.uf = self.portal.acl_users self.uf.userFolderAddUser('root', 'secret', ['Manager'], []) self.ptool = getToolByName(self.portal, 'portal_properties') self.site_props = self.ptool.site_properties
#-*- coding: utf-8 -*- # $Id: common.py 57531 2008-01-23 16:40:27Z glenfant $ """OpenXml testing package: testing resources""" from Products.PloneTestCase import PloneTestCase from Products.OpenXml.config import PROJECTNAME PloneTestCase.installProduct(PROJECTNAME) PloneTestCase.setupPloneSite(products=[PROJECTNAME])
# instead of installProduct(). # This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('bungenicms.workspaces') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['bungenicms.workspaces']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """
from Products.Archetypes import public as atapi from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import onsetup from Products.PloneTestCase.setup import default_password, portal_owner @onsetup def setup_linkchecker_policy(): ztc.installProduct('Five') fiveconfigure.debug_mode = True import gocept.linkchecker zcml.load_config('configure.zcml', gocept.linkchecker) fiveconfigure.debug_mode = False ztc.installPackage('gocept.linkchecker') ztc.installProduct('ZCatalog') setup_linkchecker_policy() ptc.setupPloneSite(products=['gocept.linkchecker']) class LinkCheckerTestCase(ptc.FunctionalTestCase): def __init__(self, *args, **kw): super(LinkCheckerTestCase, self).__init__(*args, **kw) self.portal_owner = portal_owner self.default_password = default_password
# This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('adi.stepbystep') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['adi.stepbystep']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """ def afterSetUp(self):
""" Base """ import eea.translations from Products.PloneTestCase import PloneTestCase from Products.PloneTestCase.layer import onsetup from Products.Five import zcml from Products.Five import fiveconfigure @onsetup def setup_translations(): """ Setup translations """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', eea.translations) fiveconfigure.debug_mode = False setup_translations() PloneTestCase.setupPloneSite(extension_profiles=('eea.translations:default', )) class EEATranslationsTestCase(PloneTestCase.FunctionalTestCase): """ Test case class used for functional translations tests. """
def setup_product(): """ we need install our product so the testing zope server know it. """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', leocornus.sitesadmin) # we need use installProduct instead of installPackage for membrane # version 1.1bx. version 2.0 will be different. ZopeTestCase.installProduct('membrane') ZopeTestCase.installPackage('leocornus.sitesadmin') setup_product() # we need a Plone site for some of the module. PloneTestCase.setupPloneSite(products=['leocornus.sitesadmin'], extension_profiles=["membrane:default"]) # try to setup one more plone site for testing. PloneTestCase.setupPloneSite(id='sso_testing') # base test case for our product. class SitesAdminTestCase(PloneTestCase.PloneTestCase): """ General steps for all test cases. """ def afterSetUp(self): self.loginAsPortalOwner() self.acl_users = self.portal.acl_users
""" Base test module """ from Products.PloneTestCase import PloneTestCase from Products.PloneTestCase.layer import onsetup from Products.Five import zcml from Products.Five import fiveconfigure import Products.EEATemplatesService @onsetup def setup_eeacontenttypes(): """ Setup eeacontenttypes """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', Products.EEATemplatesService) fiveconfigure.debug_mode = False PloneTestCase.installPackage('collective.monkeypatcher') PloneTestCase.installPackage('collective.fastview') setup_eeacontenttypes() PloneTestCase.setupPloneSite( extension_profiles=('Products.EEATemplatesService:default', 'Products.EEATemplatesService:testfixture')) class EEATemplatesService(PloneTestCase.FunctionalTestCase): """ EEATemplatesService FunctionalTestCase class """
@onsetup def setup_product(): """ """ fiveconfigure.debug_mode = True zcml.load_config('configure.zcml', transmogrify.webcrawler) fiveconfigure.debug_mode = False ztc.installPackage('plone.app.z3cform') # ztc.installPackage('lovely.remotetask') ztc.installPackage('transmogrify.webcrawler') setup_product() #ptc.setupPloneSite(extension_profiles=('transmogrify.webcrawler:default',), with_default_memberarea=False) ptc.setupPloneSite(products=['transmogrify.webcrawler']) class TestCase(ptc.FunctionalTestCase): """ We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ _configure_portal = False def beforeTearDown(self): pass def afterSetUp(self): here = abspath(dirname(__file__)) url = urllib.pathname2url(here) self.testsite = 'file://%s/test_staticsite' % url
# Load the ZCML configuration for the example.tests package. # This can of course use <include /> to include other packages. fiveconfigure.debug_mode = True import uwosh.themebase zcml.load_config('configure.zcml', uwosh.thememain) fiveconfigure.debug_mode = False # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['uwosh.thememain']) #this is what we would like to generate so we can test it out. site_structure = { 'future-students': { 'undergraduate': { 'academic': {}, 'admissions': {}, 'costs-and-financial-aid': {}, 'scholarships': {}, 'health-and-wellness': {}, 'athletics': {}, 'compus-life': {}, 'student-organizations': {} }, 'graduate': {},
# instead of installProduct(). # This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('collective.collage.megamenu') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['collective.collage.megamenu']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ from OFS.interfaces import IFolder class ISpecialFolder(IFolder): pass class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here.
import unittest #from zope.testing import doctestunit #from zope.component import testing from Testing import ZopeTestCase as ztc from Products.Five import fiveconfigure from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite ptc.setupPloneSite() import rtbs.contenttypes class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): fiveconfigure.debug_mode = True ztc.installPackage(rtbs.contenttypes) fiveconfigure.debug_mode = False @classmethod def tearDown(cls): pass def test_suite(): return unittest.TestSuite([
import doctest import unittest from Testing import ZopeTestCase as ztc from Products.Five import zcml from Products.PloneTestCase import PloneTestCase as ptc from Products.PloneTestCase.layer import PloneSite from Products.PloneTestCase.layer import onsetup import collective.packagekit OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \ doctest.ELLIPSIS ptc.setupPloneSite(products=['collective.packagekit']) class TestCase(ptc.PloneTestCase): class layer(PloneSite): @classmethod def setUp(cls): zcml.load_config('configure.zcml', collective.packagekit) @classmethod def tearDown(cls): pass def test_suite(): return unittest.TestSuite([
# This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('collective.opensearch') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['collective.opensearch']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """ def afterSetUp(self):
# This is *only* necessary for packages outside the Products.* # namespace which are also declared as Zope 2 products, using # <five:registerPackage /> in ZCML. # We may also need to load dependencies, e.g.: # ztc.installPackage('borg.localrole') ztc.installPackage('art.mashup') # The order here is important: We first call the (deferred) function # which installs the products we need for this product. Then, we let # PloneTestCase set up this product on installation. setup_product() ptc.setupPloneSite(products=['art.mashup']) class TestCase(ptc.PloneTestCase): """We use this base class for all the tests in this package. If necessary, we can put common utility or setup code in here. This applies to unit test cases. """ class FunctionalTestCase(ptc.FunctionalTestCase): """We use this class for functional integration tests that use doctest syntax. Again, we can put basic common utility or setup code in here. """ def afterSetUp(self):