Exemple #1
0
def _main():
    if _part_of_zope_suite():
        _start_zope()
    else:
        from Testing.ZopeTestCase import installProduct
        installProduct('Five')
        installProduct('PythonScripts')
    _load_test_config()
Exemple #2
0
def _main():
    if _part_of_zope_suite():
        _start_zope()
    else:
        from Testing.ZopeTestCase import installProduct
        installProduct('Five')
        installProduct('PythonScripts')
    _load_test_config()
Exemple #3
0
def test_suite():
    import unittest
    from Testing.ZopeTestCase import installProduct, ZopeDocFileSuite
    from Testing.ZopeTestCase import FunctionalDocFileSuite
    installProduct('PythonScripts')  # for Five.testing.restricted
    return unittest.TestSuite((
        ZopeDocFileSuite('pages.txt', package='Products.Five.browser.tests'),
        FunctionalDocFileSuite('pages_ftest.txt',
                               package='Products.Five.browser.tests'),
    ))
 def setUp(cls):
     installProduct('salesforcebaseconnector')
     # add the connector
     root = app()
     portal = root.plone
     portal.manage_addProduct['salesforcebaseconnector'].manage_addTool('Salesforce Base Connector', None)
     portal.portal_salesforcebaseconnector.setCredentials(sfconfig.USERNAME, sfconfig.PASSWORD)
     # and commit the changes
     commit()
     close(root)
Exemple #5
0
def test_suite():
    import unittest
    from Testing.ZopeTestCase import installProduct, ZopeDocFileSuite
    from Testing.ZopeTestCase import FunctionalDocFileSuite
    installProduct('PythonScripts')  # for Five.tests.testing.restricted
    return unittest.TestSuite((
            ZopeDocFileSuite('resource.txt',
                             package='Products.Five.browser.tests'),
            FunctionalDocFileSuite('resource_ftest.txt',
                                   package='Products.Five.browser.tests'),
            ))
def test_suite():
    suite = unittest.TestSuite()
    try:
        import Products.PythonScripts
    except ImportError:
        pass
    else:
        from Testing.ZopeTestCase import ZopeDocTestSuite
        from Testing.ZopeTestCase import installProduct
        installProduct('PythonScripts')
        suite.addTest(ZopeDocTestSuite())
    return suite
 def setUp(cls):
     installProduct('salesforcebaseconnector')
     # add the connector
     root = app()
     portal = root.cmf
     portal.manage_addProduct['salesforcebaseconnector'].manage_addTool(
         'Salesforce Base Connector', None)
     portal.portal_salesforcebaseconnector.setCredentials(
         sfconfig.USERNAME, sfconfig.PASSWORD)
     # and commit the changes
     commit()
     close(root)
def test_suite():
    from Products.CMFCore.utils import getToolByName
    from Products.Five.utilities.marker import erase as noLongerProvides
    from Products.PloneTestCase import setup
    from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
    from Testing.ZopeTestCase import installProduct
    from opencore.geotagging.browser import viewlets
    from opencore import geotagging
    from opencore.testing import utils
    from pprint import pprint
    from zope.component import getUtility
    from zope.interface import alsoProvides, verify
    from Products.PleiadesGeocoder.interfaces import IGeoItemSimple
    from opencore.utility.interfaces import IProvideSiteConfig
    import pdb

    installProduct('PleiadesGeocoder')
    # Don't need to do setupPloneSite(products=['PleiadesGeocoder']) because
    # we'll use a mock instead.
    setup.setupPloneSite()
    project_name = 'p3'
    project_admin = 'm1'
    member = 'm2'

    def get_response_output(view):
        """quick hack to be able to test output of views that call
        response.write or otherwise don't just return string data.

        Note that you get HTTP headers as well as the body - but ONLY
        on the first call in a doctest - I think because the request &
        response objects are re-used? This sucks, but I don't know how
        to hack around it right now, except to expect this in tests...
        """
        from cStringIO import StringIO
        response = view.request.RESPONSE
        response.stdout = StringIO()
        view()
        return response.stdout.getvalue()

    globs = locals()
    readme = dtf.FunctionalDocFileSuite(
        "README.txt", 
        optionflags=optionflags,
        package='opencore.geotagging.browser',
        test_class=FunctionalTestCase,
        globs = globs,
        setUp=readme_setup,
        tearDown=readme_teardown,
        layer = test_layer
        )

    suites = (readme, )
    return unittest.TestSuite(suites)
Exemple #9
0
def test_suite():
    suite = unittest.TestSuite()
    try:
        import Products.PythonScripts  # NOQA
    except ImportError:
        pass
    else:
        from Testing.ZopeTestCase import ZopeDocTestSuite
        from Testing.ZopeTestCase import installProduct
        installProduct('PythonScripts')
        suite.addTest(ZopeDocTestSuite())
    return suite
Exemple #10
0
def test_suite():
    import unittest
    from Testing.ZopeTestCase import installProduct, ZopeDocFileSuite
    from Testing.ZopeTestCase import FunctionalDocFileSuite
    installProduct('PythonScripts')  # for Five.testing.restricted
    suite = unittest.TestSuite(
       (ZopeDocFileSuite('pages.txt',
                         package='Products.Five.browser.tests'),
        FunctionalDocFileSuite('pages_ftest.txt',
                               package='Products.Five.browser.tests'))
       )
    suite.addTest(unittest.makeSuite(TestViewAcquisitionWrapping))
    return suite
class ProfileMetadataTests(ZopeTestCase):

    installProduct('GenericSetup')

    def test_parseXML(self):
        metadata = ProfileMetadata('')
        parsed = metadata.parseXML(_METADATA_XML)
        self.assertEqual(parsed, _METADATA_MAP)

    def test_relativePath(self):
        profile_id = 'dummy_profile2'
        product_name = 'GenericSetup'
        profile_registry.registerProfile(profile_id,
                                         'Dummy Profile',
                                         'This is a dummy profile',
                                         'tests/metadata_profile',
                                         product=product_name)
        profile_info = profile_registry.getProfileInfo(
            '%s:%s' % (product_name, profile_id))
        self.assertEqual(profile_info['description'],
                         'Description from metadata')

    def test_parseXML_empty_dependencies(self):
        # https://bugs.launchpad.net/bugs/255301
        metadata = ProfileMetadata('')
        parsed = metadata.parseXML(_METADATA_EMPTY_DEPENDENCIES_XML)
        self.assertEqual(parsed, _METADATA_MAP_EMPTY_DEPENDENCIES)
Exemple #12
0
class ProfileMetadataTests( ZopeTestCase ):

    installProduct('GenericSetup')

    def test_parseXML(self):
        metadata = ProfileMetadata( '' )
        parsed = metadata.parseXML( _METADATA_XML )
        self.assertEqual(parsed, _METADATA_MAP)

    def test_versionFromProduct(self):
        profile_id = 'dummy_profile'
        product_name = 'GenericSetup'
        directory = os.path.split(__file__)[0]
        path = os.path.join(directory, 'default_profile')
        profile_registry.registerProfile( profile_id,
                                          'Dummy Profile',
                                          'This is a dummy profile',
                                          path,
                                          product=product_name)
        profile_info = profile_registry.getProfileInfo('%s:%s' % (product_name,
                                                                  profile_id))
        product = getattr(self.app.Control_Panel.Products, product_name)
        self.assertEqual(profile_info['version'], product.version)

    def test_parseXML_empty_dependencies(self):
        # https://bugs.launchpad.net/bugs/255301
        metadata = ProfileMetadata( '')
        parsed = metadata.parseXML(_METADATA_EMPTY_DEPENDENCIES_XML)
        self.assertEqual(parsed, _METADATA_MAP_EMPTY_DEPENDENCIES)
Exemple #13
0
 def setUp(cls):
     # load zcml
     metaconfigure.debug_mode = True
     from plone.app.blob import tests
     zcml.load_config('testing.zcml', tests)
     from Products import LinguaPlone
     zcml.load_config('configure.zcml', LinguaPlone)
     metaconfigure.debug_mode = False
     # install packages, import profiles...
     installPackage('plone.app.blob', quiet=True)
     installProduct('LinguaPlone', quiet=True)
     root = app()
     portal = root.plone
     profile = 'profile-plone.app.blob:testing-lingua'
     tool = getToolByName(portal, 'portal_setup')
     tool.runAllImportStepsFromProfile(profile, purge_old=False)
     # make sure it's loaded...
     types = getToolByName(portal, 'portal_types')
     assert types.getTypeInfo('BlobelFish')
     # and commit the changes
     commit()
     close(root)
class ProfileMetadataTests(ZopeTestCase):

    installProduct('GenericSetup')

    def test_parseXML(self):
        metadata = ProfileMetadata('')
        parsed = metadata.parseXML(_METADATA_XML)
        self.assertEqual(parsed, _METADATA_MAP)

    def test_relativePath(self):
        profile_id = 'dummy_profile2'
        product_name = 'GenericSetup'
        profile_registry.registerProfile(profile_id,
                                         'Dummy Profile',
                                         'This is a dummy profile',
                                         'tests/metadata_profile',
                                         product=product_name)
        profile_info = profile_registry.getProfileInfo(
            '%s:%s' % (product_name, profile_id))
        self.assertEqual(profile_info['description'],
                         'Description from metadata')
class ProfileMetadataTests( ZopeTestCase ):

    installProduct('GenericSetup')

    def test_parseXML(self):
        metadata = ProfileMetadata( '' )
        parsed = metadata.parseXML( _METADATA_XML )
        self.assertEqual(parsed, _METADATA_MAP)

    def test_versionFromProduct(self):
        import warnings
        warnings.filterwarnings('ignore')
        try:
            profile_id = 'dummy_profile'
            product_name = 'GenericSetup'
            directory = os.path.split(__file__)[0]
            path = os.path.join(directory, 'default_profile')
            profile_registry.registerProfile( profile_id,
                                              'Dummy Profile',
                                              'This is a dummy profile',
                                              path,
                                              product=product_name)
            profile_info = profile_registry.getProfileInfo(
                                '%s:%s' % (product_name, profile_id))
            product = getattr(self.app.Control_Panel.Products, product_name)
            self.assertEqual(profile_info['version'], product.version)
        finally:
            warnings.resetwarnings()

    def test_relativePath(self):
        profile_id = 'dummy_profile2'
        product_name = 'GenericSetup'
        profile_registry.registerProfile(
            profile_id, 'Dummy Profile', 'This is a dummy profile',
            'tests/metadata_profile', product=product_name)
        profile_info = profile_registry.getProfileInfo(
            '%s:%s' % (product_name, profile_id))
        self.assertEqual(profile_info['description'],
                         'Description from metadata')
    HAS_SALESFORCE = True
except ImportError:
    HAS_SALESFORCE = False

# BBB Zope 2.12
try:
    from Zope2.App import zcml
    from OFS import metaconfigure
    zcml # pyflakes
    metaconfigure
except ImportError:
    from Products.Five import zcml
    from Products.Five import fiveconfigure as metaconfigure


installProduct('PloneFormGen')
installProduct('salesforcebaseconnector')
installProduct('salesforcepfgadapter')


class Session(dict):
    def set(self, key, value):
        self[key] = value


class MegaphoneLayer(PloneSite):
    
    @classmethod
    def setUp(cls):
        metaconfigure.debug_mode = True
        import collective.megaphone
Exemple #17
0
# helper module to ease setting up backward-compatibility tests for
# ATContentTypes and CMFPlone

from Testing.ZopeTestCase import installProduct
from plone.app.blob.tests import db  # set up a blob-aware zodb first
from plone.app.blob.tests.layer import BlobReplacementLayer

installProduct('GenericSetup', quiet=True)
installProduct('Marshall', quiet=True)

plone = BlobReplacementLayer
db  # make pyflakes happy...
from Acquisition import Implicit
from Testing.ZopeTestCase import installProduct
from zope.component import getSiteManager
from zope.globalrequest import clearRequest
from zope.globalrequest import setRequest
from zope.interface import implementer
from zope.testing.cleanup import cleanUp

from ..interfaces import IContentish
from ..interfaces import IWorkflowTool
from .base.dummy import DummyContent
from .base.dummy import DummySite
from .base.testcase import SecurityTest

installProduct('PluginIndexes')


class FakeFolder(Implicit):
    id = 'portal'


class FakeWorkflowTool(Implicit):
    id = 'portal_workflow'

    def __init__(self, vars):
        self._vars = vars

    def getCatalogVariablesFor(self, ob):
        return self._vars
Exemple #19
0
"""Test layer for dexterity.membrane
"""
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import installPackage
from Products.PloneTestCase.layer import PloneSite
from Zope2.App import zcml
from Products.Five import fiveconfigure as metaconfigure


class DexterityMembraneLayer(PloneSite):
    @classmethod
    def setUp(cls):
        metaconfigure.debug_mode = True
        import dexterity.membrane
        zcml.load_config('configure.zcml', dexterity.membrane)
        metaconfigure.debug_mode = False
        installPackage('collective.indexing')
        installPackage('dexterity.membrane')

    @classmethod
    def tearDown(cls):
        pass


# When using the defined layer, we need to make sure these Products are
# available:
installProduct('membrane')
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct('CMFPlacefulWorkflow')
installProduct('membrane')
installProduct('borg')
# don't need to install products in lib/python
setupPloneSite()

from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite


class TestCase(FunctionalTestCase):
    """Passubscribers test case."""
    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts([
            'CMFPlacefulWorkflow', 'membrane', 'zopen.plone.org',
            'zopen.plone.project'
        ],
                                                          stoponerror=True)

Exemple #21
0
from collective.testcaselayer import ptc
from euphorie.client import model
from euphorie.testing import EuphorieFunctionalTestCase
from Products.PloneTestCase import PloneTestCase
from Testing.ZopeTestCase import installProduct
from z3c.appconfig.interfaces import IAppConfig
from z3c.saconfig import Session
from zope.component import getUtility

import os.path

PloneTestCase.setupPloneSite()

# This should in theory work in the afterSetUp() method, but it does not work there
installProduct("membrane")

TEST_INI = os.path.join(os.path.dirname(__file__), "test.ini")


class OiRATestLayer(ptc.BasePTCLayer):
    def afterSetUp(self):
        from euphorie.client import tests
        from Testing.ZopeTestCase import installPackage

        import euphorie.deployment
        import osha.oira
        import pas.plugins.ldap

        self.loadZCML("configure.zcml", package=pas.plugins.ldap)
        self.loadZCML("configure.zcml", package=euphorie.deployment)
        self.loadZCML("overrides.zcml", package=euphorie.deployment)
Exemple #22
0
def test_suite():
    from Testing.ZopeTestCase import installProduct, FunctionalDocFileSuite
    installProduct('Five')
    installProduct('PlacelessTranslationService')
    return FunctionalDocFileSuite('pts_test_languages.txt',
                                  package='Products.Five.browser.tests')
##############################################################################
"""Example functional doctest

$Id: testFunctionalDocTest.py 76991 2007-06-23 17:26:25Z shh $
"""

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

from unittest import TestSuite
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import FunctionalDocTestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite

installProduct('PythonScripts')


def setUp(self):
    '''This method will run after the test_class' setUp.

    >>> print http(r"""
    ... GET /test_folder_1_/index_html HTTP/1.1
    ... """)
    HTTP/1.1 200 OK
    Content-Length: 5
    Content-Type: text/plain; charset=...
    <BLANKLINE>
    index

    >>> foo
Exemple #24
0
 def afterSetUp(self):
     from Products import LinguaPlone
     zcml.load_config('configure.zcml', LinguaPlone)
     installProduct('LinguaPlone', quiet=True)
     self.addProfile('LinguaPlone:default')
Exemple #25
0
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct('SimpleAttachment')
# don't need to install products in lib/python
setupPloneSite()

from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite

class TestCase(FunctionalTestCase):
    """Passubscribers test case."""

    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts(
                ['SimpleAttachment', 'zopen.plone.messageboard'], stoponerror=True)

def test_suite():
    suites = [
        FunctionalDocFileSuite(
            filename,
            package='zopen.plone.messageboard',
            optionflags=ELLIPSIS,
            test_class=TestCase)
Exemple #26
0
# -*- coding: utf-8 -*-

# helper module to ease setting up backward-compatibility tests for
# ATContentTypes and CMFPlone

from Products.Five import fiveconfigure
from Testing.ZopeTestCase import installPackage
from Testing.ZopeTestCase import installProduct
from Zope2.App.zcml import load_config

installProduct('Five', quiet=True)

fiveconfigure.debug_mode = True

import plone.app.folder

load_config('configure.zcml', plone.app.folder)
fiveconfigure.debug_mode = False

installPackage('plone.app.folder', quiet=True)
Exemple #27
0
def test_suite():
    from Testing.ZopeTestCase import installProduct, FunctionalDocFileSuite
    installProduct('Five')
    installProduct('BTreeFolder2')
    installProduct('CMFCalendar')
    installProduct('CMFCore')
    installProduct('CMFDefault')
    installProduct('CMFTopic')
    installProduct('DCWorkflow')
    installProduct('Localizer')
    installProduct('MailHost')
    installProduct('CPSCore')
    installProduct('CPSDefault')
    installProduct('CPSDirectory')
    installProduct('CPSUserFolder')
    installProduct('TranslationService')
    installProduct('SiteAccess')
    # these products should (and used to be) be optional, but they
    # aren't right now.
    installProduct('CPSForum')
    installProduct('CPSSubscriptions')
    installProduct('CPSNewsLetters')
    installProduct('CPSSchemas')
    installProduct('CPSDocument')
    installProduct('PortalTransforms')
    installProduct('Epoz')
    # optional products, but apparently still needed...
    installProduct('CPSRSS')
    installProduct('CPSChat')
    installProduct('CPSCalendar')
    installProduct('CPSCollector')
    installProduct('CPSMailBoxer')

    return FunctionalDocFileSuite('cps_test_localizer.txt',
                                  package='Products.Five.browser.tests')
Exemple #28
0
# helper module to ease setting up backward-compatibility tests for
# ATContentTypes and CMFPlone

from Testing.ZopeTestCase import installProduct
from plone.app.blob.tests import db     # set up a blob-aware zodb first
from plone.app.blob.tests.layer import BlobReplacementLayer

installProduct('GenericSetup', quiet=True)
installProduct('Marshall', quiet=True)

plone = BlobReplacementLayer
db  # make pyflakes happy...
Exemple #29
0
"""Test layer for dexterity.membrane
"""
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import installPackage
from Products.PloneTestCase.layer import PloneSite
from Zope2.App import zcml
from Products.Five import fiveconfigure as metaconfigure


class DexterityMembraneLayer(PloneSite):

    @classmethod
    def setUp(cls):
        metaconfigure.debug_mode = True
        import dexterity.membrane
        zcml.load_config('configure.zcml', dexterity.membrane)
        metaconfigure.debug_mode = False
        installPackage('collective.indexing')
        installPackage('dexterity.membrane')

    @classmethod
    def tearDown(cls):
        pass


# When using the defined layer, we need to make sure these Products are
# available:
installProduct('membrane')
for dependency in PRODUCT_DEPENDENCIES + DEPENDENCIES:
    ZopeTestCase.installProduct(dependency)

ZopeTestCase.installProduct('UpfrontAccounting')

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

testcase = PloneTestCase.PloneTestCase
##code-section module-before-plone-site-setup #fill in your manual code here
from Products.UpfrontAccounting.content.AccountingFolder import \
        AccountingFolder
from Products.FinanceFields.config import CURRENCY_DISPLAY_LIST
from Testing.ZopeTestCase import installProduct
installProduct('ZCatalog', 1)
##/code-section module-before-plone-site-setup

PloneTestCase.setupPloneSite(products=PRODUCTS)

class testUpfrontAccounting(testcase):
    """Base TestCase for UpfrontAccounting."""

    ##code-section class-header_testUpfrontAccounting #fill in your manual code here
    ##/code-section class-header_testUpfrontAccounting

    # Commented out for now, it gets blasted at the moment anyway.
    # Place it in the protected section if you need it.
    #def afterSetup(self):
    #    """
    #    """
Exemple #31
0
from OFS.interfaces import IItem
from OFS.SimpleItem import Item
from Products.Five.utilities.marker import MarkerInterfacesAdapter
from Testing.ZopeTestCase import ZopeTestCase
from Testing.ZopeTestCase import installProduct
from zope.component import provideAdapter
from zope.component.interface import provideInterface
from zope.interface import directlyProvides
from zope.testing.cleanup import cleanUp

from Products.GenericSetup.testing import DummySetupEnviron
from Products.GenericSetup.testing import IDummyMarker
from Products.GenericSetup.utils import PrettyDocument

installProduct('GenericSetup')

_EMPTY_PROPERTY_EXPORT = """\
<?xml version="1.0"?>
<dummy>
 <property name="foo_boolean" type="boolean">False</property>
 <property name="foo_date" type="date">1970/01/01</property>
 <property name="foo_float" type="float">0.0</property>
 <property name="foo_int" type="int">0</property>
 <property name="foo_lines" type="lines"/>
 <property name="foo_long" type="long">0</property>
 <property name="foo_string" type="string"></property>
 <property name="foo_text" type="text"></property>
 <property name="foo_tokens" type="tokens"/>
 <property name="foo_selection" select_variable="foobarbaz"
    type="selection"></property>
Exemple #32
0
def test_suite():
    from Testing.ZopeTestCase import installProduct, FunctionalDocFileSuite
    installProduct('Five')
    installProduct('BTreeFolder2')
    installProduct('CMFCalendar')
    installProduct('CMFCore')
    installProduct('CMFDefault')
    installProduct('CMFTopic')
    installProduct('DCWorkflow')
    installProduct('Localizer')
    installProduct('MailHost')
    installProduct('CPSCore')
    installProduct('CPSDefault')
    installProduct('CPSDirectory')
    installProduct('CPSUserFolder')
    installProduct('TranslationService')
    installProduct('SiteAccess')
    # these products should (and used to be) be optional, but they
    # aren't right now.
    installProduct('CPSForum')
    installProduct('CPSSubscriptions')
    installProduct('CPSNewsLetters')
    installProduct('CPSSchemas')
    installProduct('CPSDocument')
    installProduct('PortalTransforms')
    installProduct('Epoz')
    # optional products, but apparently still needed...
    installProduct('CPSRSS')
    installProduct('CPSChat')
    installProduct('CPSCalendar')
    installProduct('CPSCollector')
    installProduct('CPSMailBoxer')

    return FunctionalDocFileSuite('cps_test_localizer.txt',
                                  package='Products.Five.browser.tests')
Exemple #33
0
import os.path
from zope.component import getUtility
from z3c.saconfig import Session
from z3c.appconfig.interfaces import IAppConfig
from Testing.ZopeTestCase import installProduct
from collective.testcaselayer import ptc
from Products.PloneTestCase import PloneTestCase
from euphorie.deployment.tests.functional import EuphorieFunctionalTestCase
from euphorie.client import model

PloneTestCase.setupPloneSite()

# This should in theory work in the afterSetUp() method, but it does not work there
installProduct("membrane")

TEST_INI = os.path.join(os.path.dirname(__file__), "test.ini")


class OiRATestLayer(ptc.BasePTCLayer):
    def afterSetUp(self):
        from Testing.ZopeTestCase import installPackage
        from euphorie.client import tests
        import euphorie.deployment
        import osha.oira

        self.loadZCML("configure.zcml", package=euphorie.deployment)
        self.loadZCML("overrides.zcml", package=euphorie.deployment)
        self.loadZCML("configure.zcml", package=tests)
        self.loadZCML("configure.zcml", package=osha.oira)

        installPackage("plone.uuid")
##############################################################################
"""Example functional doctest

$Id$
"""

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

from unittest import TestSuite
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import FunctionalDocTestSuite
from Testing.ZopeTestCase import FunctionalDocFileSuite

installProduct('PythonScripts')


def setUp(self):
    '''This method will run after the test_class' setUp.

    >>> print http(r"""
    ... GET /test_folder_1_/index_html HTTP/1.1
    ... """)
    HTTP/1.1 200 OK
    Content-Length: 5
    Content-Type: text/plain; charset=...
    <BLANKLINE>
    index

    >>> foo
# -*- coding: UTF-8 -*-

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

# don't need to install products in lib/python
installProduct('CMFPlacefulWorkflow')
installProduct('membrane')
installProduct('borg')
installProduct('PloneChat')
installProduct('SimpleAttachment')
installProduct('Ploneboard')

setupPloneSite(with_default_memberarea=0,
        extension_profiles=('zopen.plone.basecamp:default',))

from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite

class TestCase(FunctionalTestCase):
    """Passubscribers test case."""

    def _setup(self):
        super(TestCase, self)._setup()

    def _setupHomeFolder(self):
        """ 我们的网站没有home folder,重载这个函数,以便让测试能够跑下去 """
        pass
xml_with_upper_attr = '''<?xml version="1.0"?>
<foo>
   <bar ATTR="1" />
</foo>
'''   

html_with_upper_attr = '''<html><body>
<foo>
   <bar ATTR="1" />
</foo>
</body></html>
'''   


installProduct('PageTemplates')

class ZPTUtilsTests(unittest.TestCase):

    def testExtractEncodingFromXMLPreamble(self):
        extract = encodingFromXMLPreamble
        self.assertEqual(extract('<?xml version="1.0" ?>'), 'utf-8')
        self.assertEqual(extract('<?xml encoding="utf-8" '
                                       'version="1.0" ?>'),
                         'utf-8')
        self.assertEqual(extract('<?xml encoding="UTF-8" '
                                       'version="1.0" ?>'),
                         'utf-8')
        self.assertEqual(extract('<?xml encoding="ISO-8859-15" '
                                       'version="1.0" ?>'),
                         'iso-8859-15')
Exemple #37
0
# see "LICENSE.txt" for details
#       $Id: TestBase.py,v 1.1.1.1 2008/06/28 19:22:06 dieter Exp $
'''Test base class.

The 'AdvancedQuery' tests use 'ZopeTestCase'.
You must install this package separately (under 'lib/python/Testing').
You can get 'ZopeTestCase' from Zope.org.
'''

from unittest import TestSuite, makeSuite

from Acquisition import Implicit

from Testing.ZopeTestCase import ZopeTestCase, installProduct

installProduct('ZCatalog', 1)
installProduct('ManagableIndex', 1)
installProduct('PluginIndexes', 1)

class TestCase(ZopeTestCase):
  _indexType = 'Managable FieldIndex'
  _ReverseOrder = 0
  _stringType = 0

  def afterSetUp(self):
    folder = self.folder
    folder.manage_addProduct['ZCatalog'].manage_addZCatalog('Catalog','')
    catalog = self.catalog = folder.Catalog
    catalog.manage_addIndex('I1', self._indexType)
    catalog.manage_addIndex('I2', self._indexType)
    if self._ReverseOrder:
Exemple #38
0
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct('PloneChat')
# don't need to install products in lib/python
setupPloneSite()

from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite


class TestCase(FunctionalTestCase):
    """Passubscribers test case."""
    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts(['zopen.plone.chat'],
                                                          stoponerror=True)


def test_suite():
    suites = [
        FunctionalDocFileSuite(filename,
                               package='zopen.plone.chat',
                               optionflags=ELLIPSIS,
Exemple #39
0
import unittest

from zope.interface.verify import verifyObject
from zope.component import provideAdapter
from zope.component import getGlobalSiteManager
import zope.testing.cleanup

from Testing.ZopeTestCase import installProduct

# TextIndexNG3 mucks about with sys.path; we have to install it to be able
# to import from textindexng at all.
installProduct("TextIndexNG3", quiet=True)
try:
    from textindexng.interfaces.indexable import IIndexableContent
    from textindexng.interfaces.indexable import IIndexContentCollector
    from textindexng.interfaces.converter import IConverter
    TNG3 = True
except ImportError, e:
    TNG3 = False

from Products.Reflecto.content.file import ReflectoFile
from Products.Reflecto.content.directory import ReflectoDirectory
from Products.Reflecto.tests.utils import MockReflector

#+ patch tom, 3.6.2008
from zope.component import queryUtility
#- patch


class IndexTests(unittest.TestCase):
    def setUp(self):
Exemple #40
0
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" GenericSetup.utils unit tests
"""

import unittest

from DateTime.DateTime import DateTime
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import ZopeTestCase

installProduct("GenericSetup")

_TESTED_PROPERTIES = (
    {"id": "foo_boolean", "type": "boolean", "mode": "wd"},
    {"id": "foo_date", "type": "date", "mode": "wd"},
    {"id": "foo_float", "type": "float", "mode": "wd"},
    {"id": "foo_int", "type": "int", "mode": "wd"},
    {"id": "foo_lines", "type": "lines", "mode": "wd"},
    {"id": "foo_long", "type": "long", "mode": "wd"},
    {"id": "foo_string", "type": "string", "mode": "wd"},
    {"id": "foo_text", "type": "text", "mode": "wd"},
    {"id": "foo_tokens", "type": "tokens", "mode": "wd"},
    {"id": "foo_selection", "type": "selection", "select_variable": "foobarbaz", "mode": "wd"},
    {"id": "foo_mselection", "type": "multiple selection", "select_variable": "foobarbaz", "mode": "wd"},
    {"id": "foo_boolean0", "type": "boolean", "mode": "wd"},
    {"id": "foo_date_naive", "type": "date", "mode": "wd"},
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct("CMFPlacefulWorkflow")
installProduct("membrane")
installProduct("borg")
# don't need to install products in lib/python
setupPloneSite()

from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite


class TestCase(FunctionalTestCase):
    """Passubscribers test case."""

    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts(
            ["CMFPlacefulWorkflow", "membrane", "zopen.plone.org"], stoponerror=True
        )


def test_suite():
from Acquisition import Implicit
from Testing.ZopeTestCase import installProduct
from zope.component import getSiteManager
from zope.globalrequest import clearRequest
from zope.globalrequest import setRequest
from zope.interface import implementer
from zope.testing.cleanup import cleanUp

from ..interfaces import IContentish
from ..interfaces import IWorkflowTool
from .base.dummy import DummyContent
from .base.dummy import DummySite
from .base.testcase import SecurityTest


installProduct('PluginIndexes')


class FakeFolder(Implicit):
    id = 'portal'


class FakeWorkflowTool(Implicit):
    id = 'portal_workflow'

    def __init__(self, vars):
        self._vars = vars

    def getCatalogVariablesFor(self, ob):
        return self._vars
Exemple #43
0
 def afterSetUp(self):
     from Products import LinguaPlone
     zcml.load_config('configure.zcml', LinguaPlone)
     installProduct('LinguaPlone', quiet=True)
     self.addProfile('LinguaPlone:default')
html_binary_utf8_wo_header = html_template_wo_header.encode('utf-8')

xml_with_upper_attr = b'''<?xml version="1.0"?>
<foo>
   <bar ATTR="1" />
</foo>
'''

html_with_upper_attr = b'''<html><body>
<foo>
   <bar ATTR="1" />
</foo>
</body></html>
'''

installProduct('PageTemplates')


class ZPTUtilsTests(unittest.TestCase):
    def afterSetUp(self):
        useChameleonEngine()

    def testExtractEncodingFromXMLPreamble(self):
        extract = encodingFromXMLPreamble
        self.assertEqual(extract(b'<?xml version="1.0" ?>'), DEFAULT_ENCODING)
        self.assertEqual(
            extract(b'<?xml encoding="utf-8" '
                    b'version="1.0" ?>'), 'utf-8')
        self.assertEqual(
            extract(b'<?xml encoding="UTF-8" '
                    b'version="1.0" ?>'), 'utf-8')
Exemple #45
0
# see "LICENSE.txt" for details
#       $Id: TestBase.py,v 1.3 2004/08/04 19:29:12 dieter Exp $
'''Test base class.

The 'AdvancedQuery' tests use 'ZopeTestCase'.
You must install this package separately (under 'lib/python/Testing').
You can get 'ZopeTestCase' from Zope.org.
'''

from unittest import TestSuite, makeSuite

from Acquisition import Implicit

from Testing.ZopeTestCase import ZopeTestCase, installProduct

installProduct('ZCatalog', 1)
installProduct('ManagableIndex', 1)
installProduct('PluginIndexes', 1)

class TestCase(ZopeTestCase):
  _indexType = 'Managable FieldIndex'
  _ReverseOrder = 0
  _stringType = 0

  def afterSetUp(self):
    folder = self.folder
    folder.manage_addProduct['ZCatalog'].manage_addZCatalog('Catalog','')
    catalog = self.catalog = folder.Catalog
    catalog.manage_addIndex('I1', self._indexType)
    catalog.manage_addIndex('I2', self._indexType)
    if self._ReverseOrder:
import unittest

from zope.interface.verify import verifyObject
from zope.component import provideAdapter
from zope.component import getGlobalSiteManager
import zope.testing.cleanup

from Testing.ZopeTestCase import installProduct

# TextIndexNG3 mucks about with sys.path; we have to install it to be able
# to import from textindexng at all.
installProduct("TextIndexNG3", quiet=True)
try:
    from textindexng.interfaces.indexable import IIndexableContent
    from textindexng.interfaces.indexable import IIndexContentCollector
    from textindexng.interfaces.converter import IConverter
    TNG3 = True
except ImportError, e:
    TNG3 = False

from Products.Reflecto.content.file import ReflectoFile
from Products.Reflecto.content.directory import ReflectoDirectory
from Products.Reflecto.tests.utils import MockReflector


class IndexTests(unittest.TestCase):
    def setUp(self):
        self.reflector = MockReflector()


    def testTextualSearchableText(self):
Exemple #47
0
# -*- coding: utf-8 -*-
# helper module to ease setting up backward-compatibility tests for
# ATContentTypes and CMFPlone

from plone.app.blob.tests import db  # set up a blob-aware zodb first
from plone.app.blob.tests.layer import BlobReplacementLayer
from Testing.ZopeTestCase import installProduct


installProduct("GenericSetup", quiet=True)
installProduct("Marshall", quiet=True)

plone = BlobReplacementLayer
db  # make pyflakes happy...
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct('PloneChat')
# don't need to install products in lib/python
setupPloneSite()

from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite

class TestCase(FunctionalTestCase):
    """Passubscribers test case."""

    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts(
                ['zopen.plone.chat'], stoponerror=True)

def test_suite():
    suites = [
        FunctionalDocFileSuite(
            filename,
            package='zopen.plone.chat',
            optionflags=ELLIPSIS,
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" GenericSetup.utils unit tests
"""

import unittest

from DateTime.DateTime import DateTime
from Testing.ZopeTestCase import installProduct
from Testing.ZopeTestCase import ZopeTestCase

installProduct('GenericSetup')

_TESTED_PROPERTIES = (
    {
        'id': 'foo_boolean',
        'type': 'boolean',
        'mode': 'wd'
    },
    {
        'id': 'foo_date',
        'type': 'date',
        'mode': 'wd'
    },
    {
        'id': 'foo_float',
        'type': 'float',
Exemple #50
0
def test_suite():
    from Testing.ZopeTestCase import installProduct, ZopeDocFileSuite
    installProduct('Five')
    return ZopeDocFileSuite('bridge.txt', package="Products.Five.tests")
Exemple #51
0
def test_suite():
    from Testing.ZopeTestCase import installProduct, FunctionalDocFileSuite
    installProduct('Five')
    installProduct('PlacelessTranslationService')
    return FunctionalDocFileSuite('pts_test_languages.txt',
                                  package='Products.Five.browser.tests')
Exemple #52
0
# helper module to ease setting up backward-compatibility tests for
# ATContentTypes and CMFPlone

from Testing.ZopeTestCase import installProduct, installPackage

# BBB Zope 2.12
try:
    from Zope2.App.zcml import load_config
    load_config # pyflakes
except ImportError:
    from Products.Five.zcml import load_config

from Products.Five import fiveconfigure

installProduct('Five', quiet=True)

fiveconfigure.debug_mode = True
import plone.app.folder
load_config('configure.zcml', plone.app.folder)
fiveconfigure.debug_mode = False

installPackage('plone.app.folder', quiet=True)
# -*- coding: UTF-8 -*-

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

# don't need to install products in lib/python
installProduct('CMFPlacefulWorkflow')
installProduct('membrane')
installProduct('borg')
installProduct('PloneChat')
installProduct('SimpleAttachment')
installProduct('Ploneboard')

setupPloneSite(with_default_memberarea=0,
               extension_profiles=('zopen.plone.basecamp:default', ))

from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite


class TestCase(FunctionalTestCase):
    """Passubscribers test case."""
    def _setup(self):
        super(TestCase, self)._setup()

    def _setupHomeFolder(self):
        """ 我们的网站没有home folder,重载这个函数,以便让测试能够跑下去 """
        pass
import os, sys

import unittest
from zope.testing.doctest import ELLIPSIS

from Testing.ZopeTestCase import installProduct
from Products.PloneTestCase.ptc import setupPloneSite

installProduct('CMFPlacefulWorkflow')
installProduct('membrane')
installProduct('borg')
# don't need to install products in lib/python
setupPloneSite()

from Products.CMFCore.utils import getToolByName
from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
from Products.PloneTestCase.setup import _createObjectByType
from Testing.ZopeTestCase import ZopeDocFileSuite, FunctionalDocFileSuite

class TestCase(FunctionalTestCase):
    """Passubscribers test case."""

    def _setup(self):
        super(TestCase, self)._setup()
        self.portal.portal_quickinstaller.installProducts(
                ['CMFPlacefulWorkflow', 'membrane', 'zopen.plone.org',
                'zopen.plone.project'], stoponerror=True)

def test_suite():
    suites = [
        FunctionalDocFileSuite(