예제 #1
0
파일: base.py 프로젝트: pgolf/pgolf
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']
    )
예제 #2
0
    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()
예제 #3
0
    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()
예제 #4
0
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',))
예제 #5
0
 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 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)
예제 #7
0
 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()
예제 #8
0
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
예제 #9
0
    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()
예제 #10
0
    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()
예제 #11
0
    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()
예제 #12
0
 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()
예제 #13
0
    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()
예제 #14
0
    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()
예제 #15
0
    def setUp(cls):
        """ Set up the additional products required
        """
        PRODUCTS = [
                'babble.server',
                'babble.client',
                ]
        ptc.setupPloneSite(products=PRODUCTS)

        fiveconfigure.debug_mode = True
        import babble.server
        zcml.load_config('configure.zcml', babble.server)
        import babble.client
        zcml.load_config('configure.zcml', babble.client)
        fiveconfigure.debug_mode = False
        
        browserlayer.utils.register_layer(IBabbleClientLayer, name='babble.client')

        component.provideAdapter(instanceSchemaFactory)
        SiteLayer.setUp()
예제 #16
0
ztc.installProduct('PloneFormGen')


@onsetup
def setup_package():
    # roadrunner is not working without these 2 lines
    import Products.PloneFormGen
    zcml.load_config('configure.zcml', Products.PloneFormGen)

    fiveconfigure.debug_mode = True
    import kg.locationfield
    zcml.load_config('configure.zcml', kg.locationfield)
    fiveconfigure.debug_mode = False

    ztc.installPackage('kg.locationfield')


setup_package()
ptc.setupPloneSite(products=[
    'kg.locationfield',
])


class LocationFieldTestCase(ptc.PloneTestCase):
    """Common test base class"""


class LocationFieldFunctionalTestCase(ptc.FunctionalTestCase):
    """Common functional test base class"""
예제 #17
0
from pmr2.citations.content import Citation
from pmr2.citations.browser import form


@onsetup
def setup():
    import pmr2.citations
    import pmr2.citations.tests
    fiveconfigure.debug_mode = True
    load_config('configure.zcml', pmr2.citations)
    load_config('test.zcml', pmr2.citations.tests)
    fiveconfigure.debug_mode = False


setup()
ptc.setupPloneSite()  #products=('pmr2.citations',))


class CitationBrowserTestCase(ptc.PloneTestCase):
    """\
    Standard test for the pubmed API.
    """
    def test_0000_import_form_render(self):
        context = self.portal
        request = TestRequest()
        f = form.CitationImportForm(context, request)
        # force this instance as a wrapped form to not render cruft.
        zope.interface.directlyProvides(f, IWrappedForm)
        f.update()
        result = f.render()
        self.assertTrue('test_json' in result)
예제 #18
0
    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import collective.portlet.collectionbysubject
    zcml.load_config('configure.zcml', collective.portlet.collectionbysubject)
    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.collectionbysubject')


# 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.collectionbysubject'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #19
0
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 siyavula.qa

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['siyavula.qa'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', siyavula.qa)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
예제 #20
0
from Testing import ZopeTestCase as ztc
from Products.PloneTestCase import PloneTestCase

ztc.installProduct('Scrawl')
PloneTestCase.setupPloneSite(products=['Scrawl'])


class ScrawlTestCase(PloneTestCase.PloneTestCase):
    """Base class for integration tests.
    """


class ScrawlFunctionalTestCase(PloneTestCase.FunctionalTestCase):
    """Base class for functional tests.
    """
예제 #21
0
    # 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('iscorpio.plonepm')


# 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=['iscorpio.plonepm'])


class PlonepmTestCase(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.
    """

    portal_type = ""
    title = ""


class PlonepmPortletTestCase(PlonepmTestCase):
    """
    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import collective.aaf.portlets
    zcml.load_config('configure.zcml', collective.aaf.portlets)
    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.aaf.portlets')


# 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.aaf.portlets'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #23
0
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 uwosh.double_blind_review

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['uwosh.double_blind_review'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', uwosh.double_blind_review)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
예제 #24
0
    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import cciaa.portlet.calendar
    zcml.load_config('configure.zcml', cciaa.portlet.calendar)
    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('cciaa.portlet.calendar')


# 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=['cciaa.portlet.calendar'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #25
0
""" This file is a skeleton test suite.
 It is here for letting you add new tests to the product without having to
 modify the existing testStyleInstallation.py module.
 You may modify its name to something that describes what it tests
 (keeping its 'test' prefix).
"""

from Products.PloneTestCase import PloneTestCase

PloneTestCase.installProduct('EEAPloneAdmin')
PloneTestCase.setupPloneSite(products=['EEAPloneAdmin'])


class TestSomething(PloneTestCase.PloneTestCase):
    """ Test something
    """
    def afterSetUp(self):
        """ After setup
        """
        pass

    def testSomething(self):
        """ Test something
        """
        self.assertEqual(1 + 1, 2)


def test_suite():
    """ Test suite
    """
    from unittest import TestSuite, makeSuite
예제 #26
0
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 babywithme.i18n

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['babywithme.i18n'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', babywithme.i18n)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
"""Integration tests"""

from Products.PloneTestCase import PloneTestCase
from Products.CMFCore.utils import getToolByName
from Products.WebServerAuth.plugin import authenticateEverybodyKey
from Products.WebServerAuth.utils import firstInstanceOfClass
from Products.WebServerAuth.tests.base import MockRequestTestCase, userId

PloneTestCase.installProduct('WebServerAuth')
PloneTestCase.setupPloneSite(products=['WebServerAuth'])

class TestIntegration(MockRequestTestCase):
    def testMemberFolderMaking(self):
        """Assert we make a member folder if that option in Plone is enabled."""
        membershipTool = getToolByName(self.portal, 'portal_membership')
        folderCreationWasOn = membershipTool.getMemberareaCreationFlag()
        if not folderCreationWasOn:
            membershipTool.setMemberareaCreationFlag()  # so we can test member-folder-making, which is off by default in Plone 3.0
        try:
            self._acl_users().validate(self.app.REQUEST)  # Fire off the whole PAS stack so our unholy member-folder-making authentication plugin runs.
        finally:  # Put things back as we found them.
            if not folderCreationWasOn:
                membershipTool.setMemberareaCreationFlag()
        self.failUnless(membershipTool.getHomeFolder(userId), msg="Failed to make a member folder for the new user.")
    
    def testNotMemberMaking(self):
        """Assert we don't recognize nonexistent users unless we're configured to."""
        plugin = self._plugin()
        saveAdmit = plugin.config[authenticateEverybodyKey]
        plugin.config[authenticateEverybodyKey] = False
        try:
# Install all (product-) dependencies, install them too
for dependency in DEPENDENCIES:
    ZopeTestCase.installProduct(dependency)

ZopeTestCase.installProduct('Products.BelgianEidAuthPlugin')

PRODUCTS = list()
PRODUCTS += DEPENDENCIES
PRODUCTS.append('Products.BelgianEidAuthPlugin')

testcase = PloneTestCase.PloneTestCase

##code-section module-before-plone-site-setup #fill in your manual code here
##/code-section module-before-plone-site-setup

PloneTestCase.setupPloneSite(products=PRODUCTS)

class BaseBelgianEidAuthPluginTestCase(testcase):
    """Base TestCase for BelgianEidAuthPlugin."""

    ##code-section class-header_BaseBelgianEidAuthPluginTestCase #fill in your manual code here
    def afterSetup(self):
        """
        Manage users and permissions
        """
        uf = self.portal.acl_users
        uf.userFolderAddUser('owner', 'owner', ['Member', ], [])
        uf.userFolderAddUser('member', 'member', ['Member', ], [])
        uf.userFolderAddUser('admin', 'admin', ['Manager', 'Member', ], [])
        uf.userFolderAddUser('anon', 'anon', ['Anonymous', ], [])
        self.wft = self.portal.portal_workflow
    # 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('plone.MLA_Organization')

# 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=['plone.MLA_Organization'])

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):
        roles = ('Member', 'Contributor')
# Install all (product-) dependencies, install them too
for dependency in PRODUCT_DEPENDENCIES + DEPENDENCIES:
    ZopeTestCase.installProduct(dependency)

ZopeTestCase.installProduct('CompoundField')

PRODUCTS = list()
PRODUCTS += DEPENDENCIES
PRODUCTS.append('CompoundField')

testcase = PloneTestCase.PloneTestCase
##code-section module-before-plone-site-setup #fill in your manual code here
from Globals import package_home
##/code-section module-before-plone-site-setup

PloneTestCase.setupPloneSite(products=PRODUCTS)


class CompoundFieldTestCase(testcase):
    """Base TestCase for CompoundField."""

    ##code-section class-header_CompoundFieldTestCase #fill in your manual code here
    def getInputDir(name, templdir=''):
        samples = os.path.join(package_home(globals()), 'input')
        dir = samples
        if templdir:
            dir = os.path.join(dir, templdir)

        return dir

    ##/code-section class-header_CompoundFieldTestCase
    'eea.reports': 'eea.reports:default',
    'eea.indicators': 'eea.indicators:default',
    'Products.RedirectionTool': 'Products.RedirectionTool:default',
    'Products.EEAPloneAdmin': 'Products.EEAPloneAdmin:default',
    'valentine.linguaflow': 'valentine.linguaflow:default',
}

for pkg, gs in OPTIONAL_DEPENDENCIES.items():
    try:
        __import__(pkg)
    except ImportError, err:
        pass
    else:
        PROFILES.insert(0, gs)

PloneTestCase.setupPloneSite(products=PRODUCTS, extension_profiles=PROFILES)


class EEAContentTypeTestCase(PloneTestCase.PloneTestCase):
    """Base TestCase for EEAContentTypes."""

    def setRequestMethod(self, method):
        """ Request method
        """
        self.app.REQUEST.set('REQUEST_METHOD', method)
        self.app.REQUEST.method = method

    def getAuthenticator(self):
        """ Authenticator getter
        """
        tag = AuthenticatorView('context', 'request').authenticator()
예제 #32
0
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 ntpu.behavior

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['ntpu.behavior'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', ntpu.behavior)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([

@onsetup
def setup_product():
    """ """
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', transmogrify.htmltesting)
    fiveconfigure.debug_mode = False
    ztc.installPackage('plone.app.z3cform')
    #    ztc.installPackage('lovely.remotetask')
    ztc.installPackage('transmogrify.htmltesting')


setup_product()
#ptc.setupPloneSite(extension_profiles=('transmogrify.htmltesting:default',), with_default_memberarea=False)
ptc.setupPloneSite(products=['transmogrify.htmltesting'])


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
예제 #34
0
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.RhaptosModuleEditor:default', )
ptc.setupPloneSite(extension_profiles=PROFILES)

import Products.RhaptosModuleEditor


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            fiveconfigure.debug_mode = True
            zcml.load_config('configure.zcml', Products.RhaptosModuleEditor)
            ztc.installPackage('Products.RhaptosModuleEditor')
            fiveconfigure.debug_mode = False

        @classmethod
        def tearDown(cls):
            pass
예제 #35
0
        """
        folder.invokeFactory('ATFSSItem', id=content_id)
        content = getattr(folder, content_id)
        transaction.savepoint(optimistic=True)
        self.updateContent(content, 'image', IMAGE_PATH)
        return content

    # Update content for any type

    def updateContent(self, content, field, filepath):
        """Updates a field content for a file.
        """

        from dummy import FileUpload
        file = open(filepath, 'rb')
        file.seek(0)
        filename = filepath.split('/')[-1]
        fu = FileUpload(filename=filename, file=file)
        kw = {field: fu}
        content.edit(**kw)


DEFAULT_PRODUCTS = ['kupu', 'iw.fss']

HAS_ATCT = True
ZopeTestCase.installProduct('ATContentTypes')

# Setup Plone site
PloneTestCase.setupPloneSite(products=DEFAULT_PRODUCTS,
                             extension_profiles=['iw.fss:testfixtures'])
예제 #36
0
    # 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('medialog.redirect')

# 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=['medialog.redirect'])


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.
    """
예제 #37
0
파일: tests.py 프로젝트: erral/feda.torneos
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 feda.torneos

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['feda.torneos'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', feda.torneos)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
예제 #38
0
    # 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('Products.DssPageTypes')

# 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=['Products.DssPageTypes'])


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.
    """
import unittest


from zope.testing import doctestunit
from zope.component import testing
from Testing import ZopeTestCase as ztc
from DateTime import DateTime

from Products.Five import zcml
from Products.Five import fiveconfigure
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite

ptc.setupPloneSite(products=['collective.collection.yearview'])

import collective.collection.yearview

class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            fiveconfigure.debug_mode = True
            zcml.load_config('configure.zcml',
                             collective.collection.yearview)
            fiveconfigure.debug_mode = False
            
            ztc.installPackage('collective.collection.yearview')    

        @classmethod
        def tearDown(cls):
            pass
예제 #40
0
파일: base.py 프로젝트: zopyx/pp.demo
    # 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('zopyx.authoring')
    ztc.installPackage('pp.demo')

# 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=['zopyx.authoring', 'pp.demo'])

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):
        roles = ('Member', 'Contributor')
예제 #41
0
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 onsetup


@onsetup
def setup_package():
    fiveconfigure.debug_mode = True
    import plone.portlet.static
    zcml.load_config('configure.zcml', plone.portlet.static)
    fiveconfigure.debug_mode = False
    ztc.installPackage('plone.portlet.static')


setup_package()
ptc.setupPloneSite(extension_profiles=('plone.portlet.static:default', ))


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #42
0
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.favorites

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['collective.favorites'])


class TestCase(ptc.PloneTestCase):

    class layer(PloneSite):

        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml',
              collective.favorites)

        @classmethod
        def tearDown(cls):
            pass
예제 #43
0
    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import funlog.portlet.googlead
    zcml.load_config('configure.zcml', funlog.portlet.googlead)
    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('funlog.portlet.googlead')


# 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=['funlog.portlet.googlead'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #44
0
import zope.interface
import zope.component

from plone.registry.interfaces import IRegistry

from Products.PloneTestCase import PloneTestCase as ptc

from pmr2.citations.interfaces import ICitation, ICitationSettings
from pmr2.citations.utility import *
from pmr2.citations.adapter import CitationManager
from pmr2.citations.content import Citation

#from pmr2.citations.tests.base import TestCitation


ptc.setupPloneSite(products=('pmr2.citations',))


class CitationTestCase(ptc.PloneTestCase):
    """\
    The core citation test case.
    """

    def afterSetUp(self):
        self.container = {}
        self.exporter = JsonCitationExporter()
        self.importer = JsonCitationImporter()

    def test_0000_json_import_export_cycle(self):
        testid = 'test1'
        citation = Citation(testid)
예제 #45
0
    """

    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import collective.facebook.wall
    zcml.load_config('configure.zcml', collective.facebook.wall)
    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.facebook.wall')

# 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.facebook.wall'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #46
0
파일: tests.py 프로젝트: ade25/wigo
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 wigo.statusapp

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['wigo.statusapp'])


class TestCase(ptc.PloneTestCase):
    class layer(PloneSite):
        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml', wigo.statusapp)

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
예제 #47
0
    # 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('pcp.contenttypes')

# 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=['pcp.contenttypes'])


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.
    """
예제 #48
0
@onsetup
def setupPackage():
    metaconfigure.debug_mode = True
    import Products.ResourceRegistries.tests
    load_config('test.zcml', Products.ResourceRegistries.tests)
    metaconfigure.debug_mode = False

    from Products.CMFCore.DirectoryView import registerFileExtension
    from Products.CMFCore.FSFile import FSFile
    registerFileExtension('kss', FSFile)


setupPackage()

PloneTestCase.setupPloneSite(
    extension_profiles=('Products.ResourceRegistries.tests:test', ))


class RegistryTestCase(PloneTestCase.PloneTestCase):
    def assertExpiresEqual(self, expires, moment):
        """Assert that the Expires header is equal to a moment or one
        second earlier or later.

        Should work for other headers too, but Expires is the most
        common, at least in these tests.

        There are some spurious test failures because 'now' is
        calculated, then a request is made and some headers are set,
        but this takes slightly too long and the resulting Expires
        header is one second after 'now'.
예제 #49
0
# Unit Tests for the style install and uninstall methods
#

import os, sys
if __name__ == '__main__':
    execfile(os.path.join(sys.path[0], 'framework.py'))

from Products.PloneTestCase import PloneTestCase

# CHANGE 'NuPlone' to your product name in the following lines
from Products.NuPlone.config import *
from Products.NuPlone.Extensions.utils import getSkinsFolderNames
PROJECTNAME = 'NuPlone'

PloneTestCase.installProduct(PROJECTNAME)
PloneTestCase.setupPloneSite(products=[PROJECTNAME])

class testSkinsTool(PloneTestCase.PloneTestCase):

    def afterSetUp(self):
        self.tool = getattr(self.portal, 'portal_skins')

    def testSkinSelectionCreated(self):
        """Test if a new skin exists in portal_skins."""
        for skin_selection in SKINSELECTIONS:
            self.failUnless(
                skin_selection['name'] in self.tool.getSkinSelections())

    def testSkinPaths(self):
        """Test if the skin layers in the new skin were correctly added."""
        skinsfoldernames = getSkinsFolderNames(GLOBALS)
예제 #50
0
    # 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('joomla2plone.policy')


# 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=['joomla2plone.policy'])


class Layer(tcl_ptc.BasePTCLayer):
    """Install joomla2plone.policy"""
    def afterSetUp(self):
        self.addProfile('joomla2plone.policy:default')


InstalledLayer = Layer([tcl_ptc.ptc_layer])
UninstalledLayer = tcl_ptc.ptc_layer


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
예제 #51
0
from Products.PloneTestCase import PloneTestCase

from Products.CMFPlacefulWorkflow.PlacefulWorkflowTool import WorkflowPolicyConfig_id
from CMFPlacefulWorkflowTestCase import CMFPlacefulWorkflowTestCase

try:
    _standard_permissions = ZopeTestCase._standard_permissions
except AttributeError:
    _standard_permissions = ZopeTestCase.standard_permissions

_edit_permissions     = [] # [PlacefulWorkflowPolicy_editPermission,]
_all_permissions      = _edit_permissions

#Install our product
PloneTestCase.installProduct('CMFPlacefulWorkflow')
PloneTestCase.setupPloneSite()

# Other imports
from Products.CMFCore.utils import getToolByName

class TestPlacefulWorkflow(CMFPlacefulWorkflowTestCase):
    """ Testing all add-on and modified method for workflow stuff """

    def createMember(self, id, pw, email, roles=('Member',)):
        pr = self.portal.portal_registration
        member = pr.addMember(id, pw, roles, properties={ 'username': id, 'email' : email })
        #self.failUnless(id in self.portal.Members.objectIds())
        return member

    def installation(self, productName):
        self.qi = self.portal.portal_quickinstaller
예제 #52
0
                     'restricted_smartlistfield',
                     relationship='unit_test_restricted',
                     allowed_types=('PloneArticle', ),
                     allowed_criterias=ALLOWED_CRITERIAS,
                 )))


class SimpleSmartContent(BaseContentMixin):
    """Content with a smartlist field
    """
    schema = schema


registerType(SimpleSmartContent, PROJECTNAME)

# Install Attachment field if it exists
from Products.PloneArticle.tool import USE_ATTACHMENT_FIELD

if USE_ATTACHMENT_FIELD:
    ZopeTestCase.installProduct('AttachmentField')

# Install PloneArticle
ZopeTestCase.installProduct('PloneArticle')

# Setup Plone site
if USE_ATTACHMENT_FIELD:
    PloneTestCase.setupPloneSite(
        products=['kupu', 'AttachmentField', 'PloneArticle'])
else:
    PloneTestCase.setupPloneSite(products=['kupu', 'PloneArticle'])
    fiveconfigure.debug_mode = True
    import collective.easytemplate
    zcml.load_config('configure.zcml', collective.easytemplate)
    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.easytemplate')
    ztc.installProduct('Products.LinguaPlone')    
    ztc.installProduct('PlacelessTranslationService')
    

setup_app()
ptc.setupPloneSite(products=['collective.easytemplate', "Products.LinguaPlone:LinguaPlone"])

class EasyTemplateTestCase(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.
    """

    def afterSetUp(self):
        # Might be another engine since some tests switch
        # this global variable
        engine.setDefaultEngine()

    def createContent(self):
        """ Create site content which is used in test cases. """
        self.loginAsPortalOwner()
        
예제 #54
0
    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import collective.portlet.personleadimage
    zcml.load_config('configure.zcml', collective.portlet.personleadimage)
    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.personleadimage')


# 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.personleadimage'])


class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """


class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #55
0
파일: tests.py 프로젝트: vwc/mf
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 multifloor.onepagelayout


class TestCase(ptc.PloneTestCase):

    class layer(PloneSite):

        @classmethod
        def setUp(cls):
            fiveconfigure.debug_mode = True
            ztc.installPackage(multifloor.onepagelayout)
            fiveconfigure.debug_mode = False

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([
예제 #56
0
    fiveconfigure.debug_mode = True

    for package in packages:
        __import__(package)
        module = sys.modules[package]

    zcml.load_config('configure.zcml', module)

    fiveconfigure.debug_mode = False

    for package in packages:
        ztc.installPackage(package)


setup_product()
ptc.setupPloneSite(products=packages)


class BaseFunctionalTestCase(ptc.FunctionalTestCase):
    def afterSetUp(self):
        ptc.FunctionalTestCase.afterSetUp(self)

        self.browser = Browser()
        self.browser.handleErrors = False
        self.portal.error_log._ignored_exceptions = ()

        def raising(self, info):
            import traceback
            traceback.print_tb(info[2])
            print info[1]
예제 #57
0
파일: base.py 프로젝트: adam139/devplone422
    The @onsetup decorator causes the execution of this body to be deferred
    until the setup of the Plone site testing layer.
    """

    # Load the ZCML configuration for this package and its dependencies

    fiveconfigure.debug_mode = True
    import my315ok.portlet.fetchouterhtml
    zcml.load_config('configure.zcml', my315ok.portlet.fetchouterhtml)
    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('my315ok.portlet.fetchouterhtml')

# 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=['my315ok.portlet.fetchouterhtml'])

class TestCase(ptc.PloneTestCase):
    """Base class used for test cases
    """

class FunctionalTestCase(ptc.FunctionalTestCase):
    """Test case class used for functional (doc-)tests
    """
예제 #58
0
파일: base.py 프로젝트: seanchen/plonexp
# 

@onsetup
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)
    ZopeTestCase.installPackage('leocornus.sitesadmin')

setup_product()
# we need a Plone site for some of the module.
PloneTestCase.setupPloneSite()

# base test case for our product.
class SitesAdminTestCase(PloneTestCase.PloneTestCase):
    """
    General steps for all test cases.
    """

    def afterSetUp(self):

        self.loginAsPortalOwner()

class SitesAdminFunctionalTestCase(PloneTestCase.FunctionalTestCase):
    """
    base test case class for functional test case.
    """
예제 #59
0
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 comrat.sitecontent

OPTION_FLAGS = doctest.NORMALIZE_WHITESPACE | \
               doctest.ELLIPSIS

ptc.setupPloneSite(products=['comrat.sitecontent'])


class TestCase(ptc.PloneTestCase):

    class layer(PloneSite):

        @classmethod
        def setUp(cls):
            zcml.load_config('configure.zcml',
              comrat.sitecontent)

        @classmethod
        def tearDown(cls):
            pass
예제 #60
0
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 plonetheme.responsive1140


class TestCase(ptc.PloneTestCase):

    class layer(PloneSite):

        @classmethod
        def setUp(cls):
            fiveconfigure.debug_mode = True
            ztc.installPackage(plonetheme.responsive1140)
            fiveconfigure.debug_mode = False

        @classmethod
        def tearDown(cls):
            pass


def test_suite():
    return unittest.TestSuite([