Esempio n. 1
0
def setup_product():
    """Set up the package and its dependencies.

    The @onsetup decorator causes the execution of this body to be
    deferred until the setup of the Plone site testing layer. We could
    have created our own layer, but this is the easiest way for Plone
    integration tests.
    """

    # Load the ZCML configuration for the example.tests package.
    # This can of course use <include /> to include other packages.

    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    zcml.load_config('configure.zcml', uwosh.timeconflictcards)
    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. Thus, we do it here. Note the use of installPackage()
    # 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.installProduct('ATVocabularyManager')
    ztc.installPackage('uwosh.timeconflictcards')
Esempio n. 2
0
 def setUpZope(self, app, configurationContext):
     # Load ZCML for this package
     import misitio.policy
     xmlconfig.file('configure.zcml',
                    misitio.policy,
                    context=configurationContext)
     ztc.installProduct('Products.CMFPlacefulWorkflow')
Esempio n. 3
0
def setup_uwoshsuccess():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    zcml.load_config('configure.zcml', Products.UWOshSuccess)
    fiveconfigure.debug_mode = False
    ztc.installProduct('ATVocabularyManager')
    ztc.installProduct('UWOshSuccess')
Esempio n. 4
0
def test_suite():
    from Products.PloneTestCase import setup
    from opencore.project.browser.base import ProjectBaseView
    from opencore.member.browser.view import ProfileView
    from pprint import pprint
    from Products.PleiadesGeocoder.interfaces import IGeoItemSimple, IGeoFolder,\
         IGeoreferenceable, IGeoAnnotatableContent, IGeoserializable, \
         IGeoserializableMembersFolder
    from opencore.geotagging.interfaces import IReadGeo, IWriteGeo, IReadWriteGeo
    ZopeTestCase.installProduct('PleiadesGeocoder')
    setup.setupPloneSite()

    globs = locals()

    config = dtf.ZopeDocFileSuite('configuration.txt',
                                  optionflags=optionflags,
                                  package='opencore.geotagging',
                                  test_class=OpenPlansTestCase,
                                  globs=globs,
                                  setUp=hook_setup,
                                  layer=test_layer
                                  )
    utilsunit = doctest.DocTestSuite('opencore.geotagging.utils',
                                     optionflags=optionflags)
    return unittest.TestSuite((utilsunit,
                               config,
                               ))
Esempio n. 5
0
def setup_product():
    """Set up the package and its dependencies.

    The @onsetup decorator causes the execution of this body to be
    deferred until the setup of the Plone site testing layer. We could
    have created our own layer, but this is the easiest way for Plone
    integration tests.
    """

    # Load the ZCML configuration for the example.tests package.
    # This can of course use <include /> to include other packages.

    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    zcml.load_config('configure.zcml', uwosh.timeconflictcards)
    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. Thus, we do it here. Note the use of installPackage()
    # 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.installProduct('ATVocabularyManager')
    ztc.installPackage('uwosh.timeconflictcards')
Esempio n. 6
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()
Esempio n. 7
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()
Esempio n. 8
0
def setup_uwoshsuccess():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    zcml.load_config('configure.zcml', Products.UWOshSuccess)
    fiveconfigure.debug_mode = False
    ztc.installProduct('ATVocabularyManager')
    ztc.installProduct('UWOshSuccess')
Esempio n. 9
0
 def setUpZope(self, app, configurationContext):
     # Load ZCML for this package
     import misitio.policy
     xmlconfig.file('configure.zcml',
                    misitio.policy,
                    context=configurationContext)
     ztc.installProduct('Products.CMFPlacefulWorkflow')
Esempio n. 10
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()
Esempio n. 11
0
 def setUp(cls):
     zinstall_products()
     ZopeTestCase.installProduct('OpenPlans')
     ZopeTestCase.installPackage('borg.localrole')
     make_objectmanager_site(ZopeTestCase.app())
     ZopeTestCase.installProduct('PleiadesGeocoder')
     monkey_stringio()
     txn.commit()
Esempio n. 12
0
def setup_product():
    fiveconfigure.debug_mode = True
    import quintagroup.pfg.captcha
    zcml.load_config('configure.zcml', quintagroup.pfg.captcha)
    fiveconfigure.debug_mode = False
    ztc.installProduct('PloneFormGen')
    ztc.installPackage('quintagroup.pfg.captcha')
    ztc.installPackage('quintagroup.captcha.core')
Esempio n. 13
0
def setupIndex():
    fiveconfigure.debug_mode = True
    import Products.Five
    zcml.load_config('meta.zcml', Products.Five)
    zcml.load_config('configure.zcml', Products.Five)
    import Products.DateRecurringIndex
    zcml.load_config('configure.zcml', Products.DateRecurringIndex)
    fiveconfigure.debug_mode = False
    ztc.installProduct('DateRecurringIndex')
Esempio n. 14
0
def baseAfterSetUp( self ):
    """Code that is needed is the afterSetUp of both test cases.
    """

    # This looks like a safe place to install Five.
    ZopeTestCase.installProduct('Five')

    # Set up sessioning objects
    ZopeTestCase.utils.setupCoreSessions(self.app)
Esempio n. 15
0
def baseAfterSetUp(self):
    """Code that is needed is the afterSetUp of both test cases.
    """

    # This looks like a safe place to install Five.
    ZopeTestCase.installProduct('Five')

    # Set up sessioning objects
    ZopeTestCase.utils.setupCoreSessions(self.app)
Esempio n. 16
0
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')
Esempio n. 17
0
 def setUp(cls):
     """Set up additional products and ZCML required to test this product.
     """
     ztc.installProduct('ZCatalog')
     PloneTestCase.setupPloneSite(products=['slc.synchronizer'])
     fiveconfigure.debug_mode = True
     import slc.synchronizer
     zcml.load_config('configure.zcml', slc.synchronizer)
     fiveconfigure.debug_mode = False
     ztc.installPackage('slc.synchronizer')
     SiteLayer.setUp()
Esempio n. 18
0
    def afterSetUp(self):
        fiveconfigure.debug_mode = True
        import quintagroup.plonegooglesitemaps
        zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps)
        zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps)
        fiveconfigure.debug_mode = False

        if not ptc.PLONE31:
            ztc.installProduct("plone.browserlayer")

        ztc.installPackage(PRODUCT)
Esempio n. 19
0
def setup_product():

    fiveconfigure.debug_mode = True
    import Products.SimpleCartItem
    zcml.load_config('configure.zcml', Products.SimpleCartItem)
    import Products.DataGridField
    zcml.load_config('configure.zcml', Products.DataGridField)

    fiveconfigure.debug_mode = False

    ztc.installProduct('SimpleCartItem')
    ztc.installProduct('DataGridField')
Esempio n. 20
0
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')
Esempio n. 21
0
def setup_product():

    fiveconfigure.debug_mode = True
    import Products.SimpleCartItem
    zcml.load_config('configure.zcml', Products.SimpleCartItem)
    import Products.DataGridField
    zcml.load_config('configure.zcml', Products.DataGridField)

    fiveconfigure.debug_mode = False

    ztc.installProduct('SimpleCartItem')
    ztc.installProduct('DataGridField')
Esempio n. 22
0
 def test_syncMetadata(self):
     ZopeTestCase.installProduct('MimetypesRegistry')
     ZopeTestCase.installProduct('mimetypes_registry')
     import rfa.kaltura.content.kalturavideo
     with _Monkey(rfa.kaltura.content.kalturavideo, kconnect=dummyConnect):
         import pdb; pdb.set_trace()
         
         #stupidly failing with exception: 	"AttributeError: mimetypes_registry"
         video = self._makeOne()
         video.setTitle('fooTitle')
         video.setDescription('fooDescription')
         video.setTags(['fooTag'])
         video.syncMetadata()
Esempio n. 23
0
    def test_syncMetadata(self):
        ZopeTestCase.installProduct('MimetypesRegistry')
        ZopeTestCase.installProduct('mimetypes_registry')
        import rfa.kaltura.content.kalturavideo
        with _Monkey(rfa.kaltura.content.kalturavideo, kconnect=dummyConnect):
            import pdb
            pdb.set_trace()

            #stupidly failing with exception: 	"AttributeError: mimetypes_registry"
            video = self._makeOne()
            video.setTitle('fooTitle')
            video.setDescription('fooDescription')
            video.setTags(['fooTag'])
            video.syncMetadata()
Esempio n. 24
0
def setup_app():

    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')
def setup_product():
    """Set up the package and its dependencies.

    The @onsetup decorator causes the execution of this body to be
    deferred until the setup of the Plone site testing layer. We could
    have created our own layer, but this is the easiest way for Plone
    integration tests.
    """
    ztc.installProduct('Archetypes')
    ztc.installProduct('MimetypesRegistry')
    ztc.installProduct('PortalTransforms') 
    # to support tests for translated vocabularies
    ztc.installProduct('PloneLanguageTool')
    # Load the ZCML configuration for the example.tests package.
    # This can of course use <include /> to include other packages.

    import Products.ATVocabularyManager
    import plumi.content
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    zcml.load_config('configure.zcml', plumi.content)        
    fiveconfigure.debug_mode = False
        
    ztc.installPackage('ATVocabularyManager')
    ztc.installPackage('plumi.content')
def setUpEGovSecurityManager(self):
  '''use safi PAS to be able to login organisation'''
  
  portal = self.getPortalObject()
  acl_users = portal.acl_users

  # Add EGOVUserManager
  ZopeTestCase.installProduct('ERP5eGovSecurity')
  erp5security_dispatcher = acl_users.manage_addProduct['ERP5eGovSecurity']
  # don't add it if it's already here
  if {'meta_type': 'EGOV User Manager', 'id': 'egov_users'} not in \
      erp5security_dispatcher._d._objects:
    addEGOVUserManager(erp5security_dispatcher, 'egov_users')

  if {'meta_type': 'EGOV Group Manager', 'id': 'egov_groups'} not in \
      erp5security_dispatcher._d._objects :
    addEGOVGroupManager(erp5security_dispatcher, 'egov_groups')
    
  # Register ERP5UserManager Interface
  acl_users.egov_users.manage_activateInterfaces(('IAuthenticationPlugin',
                                                  'IUserEnumerationPlugin',))
  acl_users.egov_groups.manage_activateInterfaces(('IGroupsPlugin',))

  # desactivate the erp5 plugin
  plugins = acl_users.egov_groups.plugins
  interface = plugins._getInterfaceFromName('IGroupsPlugin')
  if 'erp5_groups' in list(plugins._getPlugins(interface)):
    plugins.deactivatePlugin( interface, 'erp5_groups')
  plugins = acl_users.egov_users.plugins
  interface = plugins._getInterfaceFromName('IAuthenticationPlugin')
  if 'erp5_users' in list(plugins._getPlugins(interface)):
    plugins.deactivatePlugin( interface, 'erp5_users')
  if 'erp5_login_users' in list(plugins._getPlugins(interface)):
    plugins.deactivatePlugin( interface, 'erp5_login_users')
  interface = plugins._getInterfaceFromName('IUserEnumerationPlugin')
  if 'erp5_users' in list(plugins._getPlugins(interface)):
    plugins.deactivatePlugin( interface, 'erp5_users')
  if 'erp5_login_users' in list(plugins._getPlugins(interface)):
    plugins.deactivatePlugin( interface, 'erp5_login_users')

  # set properties to enable the login on Person and Organisation
  # and subcription forms (citizen, company, agent)
  acl_users.egov_users.manage_changeProperties(portal_type_list=[
                                                      'Person',
                                                      'Organisation'],)
  acl_users.egov_groups.manage_changeProperties(portal_type_list=[
                                                      'Person',
                                                      'Organisation'],)
  return '- EGOV security set up completed'
def setUpEGovSecurityManager(self):
    '''use safi PAS to be able to login organisation'''

    portal = self.getPortalObject()
    acl_users = portal.acl_users

    # Add EGOVUserManager
    ZopeTestCase.installProduct('ERP5eGovSecurity')
    erp5security_dispatcher = acl_users.manage_addProduct['ERP5eGovSecurity']
    # don't add it if it's already here
    if {'meta_type': 'EGOV User Manager', 'id': 'egov_users'} not in \
        erp5security_dispatcher._d._objects:
        addEGOVUserManager(erp5security_dispatcher, 'egov_users')

    if {'meta_type': 'EGOV Group Manager', 'id': 'egov_groups'} not in \
        erp5security_dispatcher._d._objects :
        addEGOVGroupManager(erp5security_dispatcher, 'egov_groups')

    # Register ERP5UserManager Interface
    acl_users.egov_users.manage_activateInterfaces((
        'IAuthenticationPlugin',
        'IUserEnumerationPlugin',
    ))
    acl_users.egov_groups.manage_activateInterfaces(('IGroupsPlugin', ))

    # desactivate the erp5 plugin
    plugins = acl_users.egov_groups.plugins
    interface = plugins._getInterfaceFromName('IGroupsPlugin')
    if 'erp5_groups' in list(plugins._getPlugins(interface)):
        plugins.deactivatePlugin(interface, 'erp5_groups')
    plugins = acl_users.egov_users.plugins
    interface = plugins._getInterfaceFromName('IAuthenticationPlugin')
    if 'erp5_users' in list(plugins._getPlugins(interface)):
        plugins.deactivatePlugin(interface, 'erp5_users')
    if 'erp5_login_users' in list(plugins._getPlugins(interface)):
        plugins.deactivatePlugin(interface, 'erp5_login_users')
    interface = plugins._getInterfaceFromName('IUserEnumerationPlugin')
    if 'erp5_users' in list(plugins._getPlugins(interface)):
        plugins.deactivatePlugin(interface, 'erp5_users')
    if 'erp5_login_users' in list(plugins._getPlugins(interface)):
        plugins.deactivatePlugin(interface, 'erp5_login_users')

    # set properties to enable the login on Person and Organisation
    # and subcription forms (citizen, company, agent)
    acl_users.egov_users.manage_changeProperties(
        portal_type_list=['Person', 'Organisation'], )
    acl_users.egov_groups.manage_changeProperties(
        portal_type_list=['Person', 'Organisation'], )
    return '- EGOV security set up completed'
def baseAfterSetUp( self ):
    """Code that is needed is the afterSetUp of both test cases.
    """

    # This looks like a safe place to install Five.
    ztc.installProduct('Five')

    # XXX monkey patch everytime (until we figure out the problem where
    #   monkeypatch gets overwritten somewhere) 
    try:
        from Products.Five import pythonproducts
        pythonproducts.setupPythonProducts(None)
    except ImportError:
        # Not needed in Plone 3
        pass
Esempio n. 29
0
def setup_product():
    """Set up the package and its dependencies.
    
    The @onsetup decorator causes the execution of this body to be deferred
    until the setup of the Plone site testing layer. We could have created our
    own layer, but this is the easiest way for Plone integration tests.
    """
    
    # Load the ZCML configuration for the example.tests package.
    # This can of course use <include /> to include other packages.
    
    ztc.installProduct('CMFPlomino')
    
    import Products.CMFPlomino
    from Products.Five import zcml
    zcml.load_config('configure.zcml', Products.CMFPlomino)
Esempio n. 30
0
def setup_matem_policy():
    """Set up the additional products required for the matem site policy.
    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 the matem.policy package.
    fiveconfigure.debug_mode = True
    import matem.policy
    zcml.load_config('configure.zcml', matem.policy)
    fiveconfigure.debug_mode = False

    # We need to tell the testing framework that these product should be
    # available. This can't happen until after we have loaded the ZCML.
    # This is *only* necessary for packages outside the Products.*
    # namespace which are also declared as Zope 2 products, using
    # <five:registerPackage /> in ZCML.
    ztc.installProduct('Collage')
Esempio n. 31
0
def baseAfterSetUp(self):
    """Code that is needed is the afterSetUp of both test cases.
    """

    # This looks like a safe place to install Five.
    ZopeTestCase.installProduct('Five')

    # XXX monkey patch everytime (until we figure out the problem where
    #   monkeypatch gets overwritten somewhere)
    try:
        from Products.Five import pythonproducts
        pythonproducts.setupPythonProducts(None)
    except ImportError:
        # Not needed in Plone 3
        pass

    # Set up sessioning objects
    ZopeTestCase.utils.setupCoreSessions(self.app)
Esempio n. 32
0
def setup_pleiades_atom():
    """Set up the additional products required for the Pleiades site policy.

    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 pleiades.atom
    zcml.load_config('configure.zcml', pleiades.atom)
    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('pleiades.workspace')
    ztc.installProduct('collective.geo.geographer')
def setup_product():
    """Set up additional products and ZCML required to test this product.

    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 collective.portlet.content
    zcml.load_config('configure.zcml', collective.portlet.content)
    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.content')
    ztc.installProduct('LinguaPlone')
def setup_product():
    """Set up additional products and ZCML required to test this product.

    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 collective.portlet.content
    zcml.load_config('configure.zcml', collective.portlet.content)
    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.content')
    ztc.installProduct('LinguaPlone')
Esempio n. 35
0
def setup_product():
    """Set up the package and its dependencies.

    The @onsetup decorator causes the execution of this body to be
    deferred until the setup of the Plone site testing layer. We could
    have created our own layer, but this is the easiest way for Plone
    integration tests.
    """

    # Load the ZCML configuration for the example.tests package.
    # This can of course use <include /> to include other packages.

    fiveconfigure.debug_mode = True
    zcml.load_config("configure.zcml", mailtoplone.base)
    zcml.load_config("configure.zcml", mailtoplone.contentrules)
    zcml.load_config("configure.zcml", mailtoplone.scrawl)
    fiveconfigure.debug_mode = False

    ztc.installProduct("Scrawl")
    ztc.installPackage("mailtoplone.base")
    ztc.installPackage("mailtoplone.contentrules")
Esempio n. 36
0
def setup_product():
    """Set up additional products and ZCML required to test this product.

    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 quintagroup.portlet.cumulus
    zcml.load_config('configure.zcml', quintagroup.portlet.cumulus)
    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('quintagroup.portlet.cumulus')
    if HAS_QUILLS_ENABLED:
        ztc.installProduct('QuillsEnabled')
Esempio n. 37
0
def test_suite():

    # Load Five ZCML
    from Products import Five

    zcml.load_config("meta.zcml", Five)
    zcml.load_config("configure.zcml", Five)

    # Load our ZCML, which add the extension as a Product
    from silva.pas import openid

    zcml.load_config("configure.zcml", openid)

    # Load the Zope Product
    ztc.installProduct("GenericSetup")
    ztc.installProduct("PluginRegistry")
    ztc.installProduct("PluggableAuthService")
    ztc.installPackage("plone.session")
    ztc.installPackage("silva.pas.base")
    ztc.installPackage("silva.pas.membership")
    ztc.installPackage("silva.pas.openid")

    # Run tests
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(OpenIDDependencyTestCase))
    suite.addTest(unittest.makeSuite(OpenIDTestCase))
    return suite
def installKupu(quiet=0):
    _start = time.time()
    if not quiet: ZopeTestCase._print('Adding Kupu ... ')

    ZopeTestCase.installProduct('kupu')

    # Install kupu into the test site. Done here because otherwise
    # it slows the tests down a lot on Plone 2.1
    app = ZopeTestCase.app()
    user = app.acl_users.getUserById(portal_owner).__of__(app.acl_users)
    newSecurityManager(None, user)

    portal = app[portal_name]
    quickinstaller = portal.portal_quickinstaller
    quickinstaller.installProduct('kupu')

    # Log out
    noSecurityManager()
    get_transaction().commit()
    if not quiet: ZopeTestCase._print('done (%.3fs)\n' \
                                      % (time.time()-_start,))
    ZopeTestCase.close(app)
Esempio n. 39
0
def installKupu(quiet=0):
    _start = time.time()
    if not quiet: ZopeTestCase._print('Adding Kupu ... ')

    ZopeTestCase.installProduct('kupu')

    # Install kupu into the test site. Done here because otherwise
    # it slows the tests down a lot on Plone 2.1
    app = ZopeTestCase.app()
    user = app.acl_users.getUserById(portal_owner).__of__(app.acl_users)
    newSecurityManager(None, user)

    portal = app[portal_name]
    quickinstaller = portal.portal_quickinstaller
    quickinstaller.installProduct('kupu')

    # Log out
    noSecurityManager()
    get_transaction().commit()
    if not quiet:        ZopeTestCase._print('done (%.3fs)\n' \
                            % (time.time()-_start,))
    ZopeTestCase.close(app)
Esempio n. 40
0
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml',
                     tv1.blob.support)
    fiveconfigure.debug_mode = False
    ztc.installPackage('tv1.blob.support')
    #Loads all dependencies modules
    for item in PRODUCTS:
        module_name = item[0]
        module = hacked_import(module_name)
        try:
            zcml.load_config('configure.zcml', module)
        except IOError:
            # Produto sem configure.zcml
            continue
    fiveconfigure.debug_mode = False
    for item in PRODUCTS:
        module_name = item[0]
        if module_name.startswith('Products'):
            module_name = module_name[9:]
            ztc.installProduct(module_name)
        else:
            ztc.installPackage(module_name)
Esempio n. 41
0
File: base.py Progetto: a25kk/mp-bbb
def installConfiguredProducts():
    config, handler = parseDependencies()

    ZopeTestCase.installProduct("PythonScripts")
    ZopeTestCase.installProduct("Five")

    def registerProduct(values):
        for pkg in values:
            ZopeTestCase.installProduct(pkg, 0)

    handler({'required' : registerProduct,
             'optional' : registerProduct,
             })
    # and finally ourselves
    ZopeTestCase.installProduct("remember")
    ZopeTestCase.installProduct("sampleremember")
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 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)
#
# Test DocFinderTab
#

from Testing import ZopeTestCase

ZopeTestCase.installProduct('DocFinderTab')

from AccessControl import Unauthorized
from Products.DocFinderTab.permissions import ViewDocPermission

standard_permissions = ZopeTestCase.standard_permissions
access_permissions = [ViewDocPermission]
all_permissions = standard_permissions + access_permissions


class TestDocFinderTab(ZopeTestCase.ZopeTestCase):
    def test_00_ItemPatched(self):
        '''Item should have been patched'''
        ob = getattr(self.app, 'aq_base', self.app)
        self.failUnless(hasattr(ob, 'showDocumentation'))
        self.failUnless(hasattr(ob, 'analyseDocumentation'))

    def test_01_AccessAllowed(self):
        'showDocumentation should be accessible'
        self.setPermissions(standard_permissions + access_permissions)
        try:
            dummy = self.folder.restrictedTraverse('showDocumentation')
        except Unauthorized:
            self.fail('Access to showDocumentation was denied')
Esempio n. 45
0
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# 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.
#
##############################################################################
""" Unit tests for FSPageTemplate module.

$Id$
"""

import unittest
from Testing import ZopeTestCase
ZopeTestCase.installProduct('PageTemplates', 1)

from os.path import join as path_join

from OFS.Folder import Folder
from Products.StandardCacheManagers import RAMCacheManager
from zope.tales.tales import Undefined

from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.FSMetadata import FSMetadata
from Products.CMFCore.testing import TraversingZCMLLayer
from Products.CMFCore.tests.base.dummy import DummyCachingManager
from Products.CMFCore.tests.base.testcase import FSDVTest
from Products.CMFCore.tests.base.testcase import RequestTest
from Products.CMFCore.tests.base.testcase import SecurityTest
Esempio n. 46
0
from base import PSCTestCase

from DateTime.DateTime import DateTime
import os
from cgi import FieldStorage
from tempfile import TemporaryFile

from ZPublisher.HTTPRequest import FileUpload

from Products.PloneSoftwareCenter.tests.utils import PACKAGE_HOME

from Testing import ZopeTestCase
try:
    from Products.Poi.interfaces import Tracker
    HAS_POI = True
    ZopeTestCase.installProduct('Poi')
except ImportError:
    HAS_POI = False


def createFileUpload(data, filename):
    fp = TemporaryFile('w+b')
    fp.write(data)
    fp.seek(0)
    env = {'REQUEST_METHOD': 'PUT'}
    headers = {'content-type':'text/plain',
               'content-length': len(data),
               'content-disposition':'attachment; filename=%s' % \
                 filename}
    fs = FieldStorage(fp=fp, environ=env, headers=headers)
    result = FileUpload(fs)
Esempio n. 47
0
    setRoles()
    setPermissions()
    login()
    logout()

$Id$
"""

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

from Testing import ZopeTestCase

ZopeTestCase.installProduct('PythonScripts')

from AccessControl import Unauthorized
from AccessControl import getSecurityManager

access_permissions = ['View management screens']
change_permissions = ['Change Python Scripts']

ps_params1 = 'a=1'
ps_body1 = 'return a'
ps_params2 = 'a'
ps_body2 = 'return a+1'


class TestPythonScript(ZopeTestCase.ZopeTestCase):
    '''Tries various things allowed by the ZopeTestCase API.'''
Esempio n. 48
0
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# 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.
#
##############################################################################
"""Skins tool xml adapter and setup handler unit tests.
"""

import unittest
from Testing import ZopeTestCase

ZopeTestCase.installProduct('CMFCore', 1)

import os

from OFS.Folder import Folder
from zope.component import getSiteManager
from zope.interface import implements

from Products.GenericSetup.testing import BodyAdapterTestCase
from Products.GenericSetup.testing import NodeAdapterTestCase
from Products.GenericSetup.tests.common import BaseRegistryTests
from Products.GenericSetup.tests.common import DummyExportContext
from Products.GenericSetup.tests.common import DummyImportContext

from Products.CMFCore.interfaces import ISkinsTool
from Products.CMFCore.testing import ExportImportZCMLLayer
Esempio n. 49
0
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# 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.
#
##############################################################################
""" Unit test layers.

$Id$
"""

from Testing import ZopeTestCase
ZopeTestCase.installProduct('ZCTextIndex', 1)
ZopeTestCase.installProduct('CMFCore', 1)

import transaction

from Products.CMFCore.testing import FunctionalZCMLLayer
from Products.CMFDefault.factory import addConfiguredSite

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


class FunctionalLayer(FunctionalZCMLLayer):
Esempio n. 50
0
#
# RhaptosTestCase
#
from Testing import ZopeTestCase
import transaction

ZopeTestCase.installProduct('CMFCore')
ZopeTestCase.installProduct('CMFDefault')
ZopeTestCase.installProduct('CMFCalendar')
ZopeTestCase.installProduct('CMFTopic')
ZopeTestCase.installProduct('DCWorkflow')
ZopeTestCase.installProduct('CMFActionIcons')
ZopeTestCase.installProduct('CMFQuickInstallerTool')
ZopeTestCase.installProduct('CMFFormController')
ZopeTestCase.installProduct('GroupUserFolder')
ZopeTestCase.installProduct('ZCTextIndex')
ZopeTestCase.installProduct('CMFPlone')
ZopeTestCase.installProduct('MailHost', quiet=1)
ZopeTestCase.installProduct('PageTemplates', quiet=1)
ZopeTestCase.installProduct('PythonScripts', quiet=1)
ZopeTestCase.installProduct('ExternalMethod', quiet=1)
ZopeTestCase.installProduct('RhaptosSite')
ZopeTestCase.installProduct('Archetypes')
ZopeTestCase.installProduct('MimetypesRegistry')
ZopeTestCase.installProduct('PortalTransforms')
ZopeTestCase.installProduct('CNXMLDocument')
ZopeTestCase.installProduct('CVSTool')
ZopeTestCase.installProduct('FSImportTool')
ZopeTestCase.installProduct('ZCatalog')
ZopeTestCase.installProduct('ZPsycopgDA')
ZopeTestCase.installProduct('ZSQLMethods')
Esempio n. 51
0
# Copyright (c) 2006 Zope Foundation and Contributors
# Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this
# distribution.
# 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.
#
##############################################################################

from Testing import ZopeTestCase

ZopeTestCase.installProduct('PluginRegistry')
ZopeTestCase.installProduct('PluggableAuthService')
ZopeTestCase.installProduct('StandardCacheManagers')
ZopeTestCase.installProduct('GenericSetup')

from Testing.ZopeTestCase import user_name
from Testing.ZopeTestCase import user_password
from Testing.ZopeTestCase import user_role

from Products.PluggableAuthService.interfaces.plugins import \
    IAuthenticationPlugin, IUserEnumerationPlugin, IRolesPlugin, \
    IRoleEnumerationPlugin, IRoleAssignerPlugin, \
    IGroupsPlugin, IGroupEnumerationPlugin, \
    IChallengePlugin, IExtractionPlugin, IUserAdderPlugin

from base64 import encodestring
Esempio n. 52
0
# -*- coding: utf-8 -*-
#
# Base TestCase for feedfeeder
#

from Testing import ZopeTestCase
from Products.PloneTestCase import PloneTestCase

ZopeTestCase.installProduct('feedfeeder')

testcase = PloneTestCase.PloneTestCase

PloneTestCase.setupPloneSite(products=['feedfeeder'])


class MainTestCase(testcase):
    """Base TestCase for feedfeeder."""


def test_suite():
    from unittest import TestSuite, makeSuite
    suite = TestSuite()
    suite.addTest(makeSuite(MainTestCase))
    return suite
Esempio n. 53
0

@onsetup
def setup_product():
    """Set up the package and its dependencies.

    The @onsetup decorator causes the execution of this body to be deferred
    until the setup of the Plone site testing layer. We could have created our
    own layer, but this is the easiest way for Plone integration tests.
    """
    fiveconfigure.debug_mode = True
    import Products.CMFPlomino
    zcml.load_config('configure.zcml', Products.CMFPlomino)
    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.

ztc.installProduct('CMFPlomino')
setup_product()
ptc.setupPloneSite(products=['CMFPlomino'],
                   extension_profiles=['Products.CMFPlomino:default'])


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.
    """
Esempio n. 54
0
import os, sys
import glob

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

import unittest
from Testing import ZopeTestCase
from Testing.ZopeTestCase.functional import Functional
from AccessControl import Unauthorized

# we need to install FiveTest *before* Five as Five processes zcml
# in all the products it can find.
ZopeTestCase.installProduct('FiveTest')
ZopeTestCase.installProduct('Five')

from zope.app.form.browser.submit import Update


class EditFormTestCase(Functional, ZopeTestCase.ZopeTestCase):
    def afterSetUp(self):
        self.folder.manage_addProduct['FiveTest'].manage_addFieldSimpleContent(
            'edittest', 'Test')
        uf = self.folder.acl_users
        uf._doAddUser('viewer', 'secret', [], [])
        uf._doAddUser('manager', 'r00t', ['Manager'], [])

    def test_editform(self):
        response = self.publish('/test_folder_1_/edittest/edit.html',
                                basic='manager:r00t')
        # we're using a GET request to post variables, but seems to be
Esempio n. 55
0
##/code-section module-header

from Testing import ZopeTestCase
from Products.PloneTestCase import PloneTestCase
from Products.Bungeni.config import PRODUCT_DEPENDENCIES
from Products.Bungeni.config import DEPENDENCIES

# Add common dependencies
DEPENDENCIES.append('Archetypes')
PRODUCT_DEPENDENCIES.append('MimetypesRegistry')
PRODUCT_DEPENDENCIES.append('PortalTransforms')
PRODUCT_DEPENDENCIES.append('Bungeni')

# Install all (product-) dependencies, install them too
for dependency in PRODUCT_DEPENDENCIES + DEPENDENCIES:
    ZopeTestCase.installProduct(dependency)

ZopeTestCase.installProduct('Bungeni')

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

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 testBungeni(testcase):
Esempio n. 56
0
from Products.ZenModel.ZentinelPortal import PortalGenerator
from Products.ZenEvents.EventManagerBase import EventManagerBase
from Products.ZenEvents.MySqlSendEvent import MySqlSendEventMixin
from Products.ZenRelations.ZenPropertyManager import setDescriptors
from Products.ZenEvents.MySqlEventManager import log
from Products.ZenUtils.Utils import unused, load_config_override
from zope.testing.cleanup import cleanUp

from Products.Zuul.catalog.model_catalog import get_solr_config
from Products.ZenUtils.virtual_root import register_cse_virtual_root
from zenoss.modelindex.model_index import SearchParams

log.warn = lambda *args, **kwds: None

# setup the Products needed for the Zenoss test instance
ZopeTestCase.installProduct('ZenModel', 1)
ZopeTestCase.installProduct('ZCatalog', 1)
ZopeTestCase.installProduct('OFolder', 1)
ZopeTestCase.installProduct('ManagableIndex', 1)
ZopeTestCase.installProduct('AdvancedQuery', 1)
ZopeTestCase.installProduct('ZCTextIndex', 1)
ZopeTestCase.installProduct('CMFCore', 1)
ZopeTestCase.installProduct('CMFDefault', 1)
ZopeTestCase.installProduct('MailHost', 1)
ZopeTestCase.installProduct('Transience', 1)
ZopeTestCase.installProduct('ZenRelations', 1)


def manage_addDummyManager(context, id):
    context._delObject(id)
    context._setObject(id, DummyManager(id))
Esempio n. 57
0
"""Test suite."""
import unittest
import zlib
from io import BytesIO

from Testing import ZopeTestCase
from ZPublisher.HTTPRequest import HTTPRequest
from ZPublisher.HTTPResponse import HTTPResponse
from ZTUtils.Tree import b2a

from Products.ZopeTree import Node, ZopeTree
from Products.ZopeTree.IZopeTree import INode, IZopeTree

ZopeTestCase.installProduct("ZopeTree")


# simple object that can have an id and a set of children
class Item:
    def __init__(self, id, children=[]):
        self.id = id
        self.children = children


# function used to convert a set of nested tuples to items and
# children items.
def make_item_from_tuple(item_tuple, dict):
    children = []
    if len(item_tuple) > 1:
        for child in item_tuple[1]:
            children.append(make_item_from_tuple(child, dict))
    item = Item(item_tuple[0], children)
Esempio n. 58
0
# -*- coding: utf-8 -*-
import unittest
import ZODB
import OFS.Application
from Products.Formulator import Validator
from Products.Formulator.StandardFields import DateTimeField
from Testing import ZopeTestCase
ZopeTestCase.installProduct('Formulator')


class TestField:
    def __init__(self, id, **kw):
        self.id = id
        self.kw = kw

    def get_value(self, name):
        # XXX hack
        return self.kw.get(name, 0)

    def get_error_message(self, key):
        return "nothing"

    def get_form_encoding(self):
        # XXX fake ... what if installed python does not support utf-8?
        return "utf-8"

    def has_value(self, id):
        return self.kw.has_key(id)


class ValidatorTestCase(unittest.TestCase):