Exemplo n.º 1
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()
Exemplo n.º 2
0
#
# This test module demonstrates a problem caused by the removal of
# a few lines of code from cAccessControl.c and ImplPython.c
# See: http://mail.zope.org/pipermail/zope-checkins/2004-August/028152.html
#
# If an object with setDefaultAccess('deny') is used as the context for
# a PythonScript, the script can no longer aquire tools from the portal
# root. Rolling back the abovementioned checkin restores functionality.
#

from Products.CMFPlone.tests import PloneTestCase

PloneTestCase.installProduct('PythonScripts')

from App.class_init import InitializeClass
from AccessControl import ClassSecurityInfo
from OFS.SimpleItem import SimpleItem


class AllowedItem(SimpleItem):
    id = 'allowed'
    security = ClassSecurityInfo()
    security.setDefaultAccess('allow')


InitializeClass(AllowedItem)


class DeniedItem(SimpleItem):
    id = 'denied'
    security = ClassSecurityInfo()
Exemplo n.º 3
0
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneFormGen)
    zcml.load_config('configure.zcml', uwosh.pfg.d2c)
    zcml.load_config('configure.zcml', collective.signupsheet)

    ZopeTestCase.installPackage('uwosh.pfg.d2c')
    ZopeTestCase.installPackage('collective.signupsheet')
    fiveconfigure.debug_mode = False


#Set up the Plone site used for the test fixture. The PRODUCTS are the products
#to install in the Plone site (as opposed to the products defined above, which
#are all products available to Zope in the test fixture)
setup_product()
PloneTestCase.setupPloneSite(
    products=['PloneFormGen', 'uwosh.pfg.d2c', 'collective.signupsheet'])


def get_file(whichone=''):
    if not whichone:
        return None
    path = os.path.join(os.path.dirname(__file__), 'files/' + whichone)
    return file(path, 'r').readlines()


class FunctionalTestCase(PloneTestCase.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.
    """
Exemplo n.º 4
0
import os

from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase

# Make sure the dummy types are registered
from Products.CMFBibliographyAT.tests import dummy

# and the types get still registered with the types tool
from Products.GenericSetup import EXTENSION, profile_registry

ZopeTestCase.installProduct('CMFBibliographyAT')
PROFILES = ['Products.CMFBibliographyAT:default']
PloneTestCase.setupPloneSite(extension_profiles=PROFILES)

# This is so we can find our own files
from Products.CMFBibliographyAT.tests import GLOBALS
from App.Common import package_home
PACKAGE_HOME = package_home(GLOBALS)

from os.path import join
MEDLINE_TEST_MED = join(PACKAGE_HOME, 'medline_test.med')
MEDLINE_TEST_BIB = join(PACKAGE_HOME, 'medline_test.bib')
MEDLINE_TEST_XML = join(PACKAGE_HOME, 'medline_test.xml')
BIBTEX_TEST_BIB = join(PACKAGE_HOME, 'bibtex_test.bib')
IDCOOKING_TEST_BIB = join(PACKAGE_HOME, 'idcooking_test.bib')
PDFFOLDER_TEST_BIB = join(PACKAGE_HOME, 'pdffolder_test.bib')
CMFBAT_TEST_PDF_1 = join(PACKAGE_HOME, 'cmfbat-pdffile1.pdf')
CMFBAT_TEST_PDF_2 = join(PACKAGE_HOME, 'cmfbat-pdffile2.pdf')
CMFBAT_TEST_PDF_3 = join(PACKAGE_HOME, 'cmfbat-pdffile3.pdf')
BIBTEX_TEST_BIB_DUP = join(PACKAGE_HOME, 'bibtex_test_duplicates.bib')
Exemplo n.º 5
0
# move files into data subdir

current_dir = os.path.dirname(__file__)
PATH_PREFIX = os.path.join(current_dir, 'data')
BAD_FILE = os.path.join(PATH_PREFIX, 'bad_atom.xml')
GOOD_FILE = os.path.join(PATH_PREFIX, 'good_atom.xml')
EXPECTED_RESULT = os.path.join(PATH_PREFIX, 'atom_post_expected_result.xml')

GIF_FILE = {
    'filename': 'beach.gif',
    'extension': 'gif',
    'content_type': 'image/gif',
}

ZopeTestCase.installProduct('rhaptos.atompub.plone', quiet=1)
PloneTestCase.setupPloneSite()


class TestAtomPub(PloneTestCase.FunctionalTestCase):
    def afterSetUp(self):
        self.addProfile('rhaptos.atompub.plone:default')
        super(TestAtomPub, self).afterSetUp()

    def testAtomFeedView(self):
        """
        Add a folder and a file.
        Get the atom feed.
        """
        creation_date = DateTime.DateTime()
        contents = 'A test file'
Exemplo n.º 6
0
 def testIMSTransportInstall(self):
     assert PloneTestCase.hasProduct('IMSTransport'), 'IMSTransport failed to install'
Exemplo n.º 7
0
    import Products.ATVocabularyManager

    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.uwosh_grants)
    zcml.load_config('configure.zcml', Products.ATVocabularyManager)
    fiveconfigure.debug_mode = False

# These must install cleanly
ZopeTestCase.installProduct('ATVocabularyManager')
ZopeTestCase.installProduct('uwosh_grants')

# Set up the Plone site used for the test fixture. The PRODUCTS are the products
# to install in the Plone site (as opposed to the products defined above, which
# are all products available to Zope in the test fixture)
PRODUCTS = ['ATVocabularyManager', 'uwosh_grants']
PloneTestCase.setupPloneSite(products=PRODUCTS)


class UwoshgrantsTestCase(PloneTestCase.PloneTestCase):
    """
    Base
    """
    _oie_users = {
        'director1': ['uwosh.grants.director'],
        'director2': ['uwosh.grants.director'],
        'panel1': ['uwosh.grants.panel'],
        'panel2': ['uwosh.grants.panel'],
        'reviewer1': ['uwosh.grants.reviewer'],
        'reviewer2': ['uwosh.grants.reviewer'],
        'reviewer3': ['uwosh.grants.reviewer'],
        'proposer2': ['Member'],
Exemplo n.º 8
0
 def testPloneBookmarkletsInstall(self):
     assert PloneTestCase.hasProduct('PloneBookmarklets'), "PloneBookmarklets failed to install"
from unittest import TestCase, TestSuite, makeSuite, main
from Products.CMFCore.WorkflowCore import WorkflowException


@onsetup
def setup_COBAInternship():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.COBAInternship)
    fiveconfigure.debug_mode = False
    #  ztc.installProduct('ATVocabularyManager')   #### no vocab used for the COBAInternship
    ztc.installProduct('COBAInternship')


setup_COBAInternship()
PloneTestCase.setupPloneSite(
    products=['ATVocabularyManager', 'COBAInternship'])


class MockTransition:
    id = 'testTransition'

    def __init__(self, id=None):
        if id is not None:
            self.id = id


class MockEvent:
    transition = MockTransition()

    def __init__(self, transitionId=None):
        if transitionId is not None:
Exemplo n.º 10
0
from DateTime import DateTime

from unittest import TestCase, TestSuite, makeSuite, main
from Products.CMFCore.WorkflowCore import WorkflowException


@onsetup
def setup_COBAInternship():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.COBAInternship)
    fiveconfigure.debug_mode = False
  #  ztc.installProduct('ATVocabularyManager')   #### no vocab used for the COBAInternship
    ztc.installProduct('COBAInternship')
    
setup_COBAInternship()
PloneTestCase.setupPloneSite(products=['ATVocabularyManager', 'COBAInternship'])



class MockTransition:
    id = 'testTransition'

    def __init__(self, id=None):
        if id is not None:
            self.id = id


class MockEvent:
    transition = MockTransition()

    def __init__(self, transitionId=None):
# are all products available to Zope in the test fixture)
PRODUCTS = ['salesforcepfgadapter']

@onsetup
def load_zcml():
    # load our zcml
    fiveconfigure.debug_mode = True
    import Products.salesforcepfgadapter
    zcml.load_config('configure.zcml', Products.salesforcepfgadapter)
    fiveconfigure.debug_mode = False
    
    import Products.salesforcepfgadapter.tests
    Products.salesforcepfgadapter.tests.TESTING = True

load_zcml()
ptc.setupPloneSite(products=PRODUCTS)

class SalesforcePFGAdapterTestCase(ptc.PloneTestCase):
    """Base class for integration tests for the 'salesforcepfgadapter' product. This may
    provide specific set-up and tear-down operations, or provide convenience
    methods.
    """
    layer = SalesforcePloneLayer
    
    def afterSetUp(self):
        self.salesforce = self.portal.portal_salesforcebaseconnector
        self._todelete = list() # keep track of ephemeral test data to delete
    

class SalesforcePFGAdapterFunctionalTestCase(ptc.FunctionalTestCase):
    """Base class for functional doctests
Exemplo n.º 12
0
import os, sys
if __name__ == '__main__':
    execfile(os.path.join(sys.path[0], 'framework.py'))

from Products.CMFPlone.tests import PloneTestCase
from Products.PlonePopoll.content import *
from Acquisition import aq_base
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager

from AccessControl import getSecurityManager, Unauthorized

from Products.CMFCore.utils import getToolByName

from Products.PloneTestCase import PloneTestCase
PloneTestCase.installProduct('PlonePopoll')

PloneTestCase.setupPloneSite()



try:
    import Log

    Log.LOG_LEVEL = Log.LOG_DEBUG

    Log.LOG_PROCESSOR = {
        Log.LOG_NONE: Log.logFile,
        Log.LOG_CRITICAL: Log.logFile,
        Log.LOG_ERROR: Log.logFile,
        Log.LOG_WARNING: Log.logFile,
##############################################################################

"""COREBlog2 tests
"""

__author__  = 'Atsushi Shibata <*****@*****.**>'
__docformat__ = 'plaintext'

from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase
from Acquisition import aq_base
from DateTime import DateTime

from Products.PloneTestCase import PloneTestCase

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

blog_id = 'blog'

entry_body = """
Header
======

Text, text, text

* List
* List
"""

entry_data = (
Exemplo n.º 14
0

@onsetup
def load_zcml():
    # load our zcml
    fiveconfigure.debug_mode = True
    import Products.salesforcepfgadapter
    zcml.load_config('configure.zcml', Products.salesforcepfgadapter)
    fiveconfigure.debug_mode = False

    import Products.salesforcepfgadapter.tests
    Products.salesforcepfgadapter.tests.TESTING = True


load_zcml()
ptc.setupPloneSite(products=PRODUCTS)


class SalesforcePFGAdapterTestCase(ptc.PloneTestCase):
    """Base class for integration tests for the 'salesforcepfgadapter' product. This may
    provide specific set-up and tear-down operations, or provide convenience
    methods.
    """
    layer = SalesforcePloneLayer

    def afterSetUp(self):
        self.salesforce = self.portal.portal_salesforcebaseconnector
        self._todelete = list()  # keep track of ephemeral test data to delete


class SalesforcePFGAdapterFunctionalTestCase(ptc.FunctionalTestCase):
import Products.PloneHelpCenter
from Products.PloneHelpCenter.config import ADD_CENTER_PERMISSION, \
  ADD_HELP_AREA_PERMISSION

# from Products.Five.testbrowser import Browser

ZopeTestCase.installProduct('PloneHelpCenter')

@onsetup
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneHelpCenter)
    fiveconfigure.debug_mode = False

setup_product()
PloneTestCase.setupPloneSite(products=['PloneHelpCenter'])


class PHCTestCase(PloneTestCase.PloneTestCase):

    defaultTitle = 'Default Testing Title'
    defaultVersions = ( 'Version 1.0', 'Version 2.0', 'Different Version1.0', )
    defaultBodyRst = """
    Bogus reST body
    ===============
    
    Here's fake body content for unit tests.
    
    * Looks like a list.
    * Smells like a list.
    * It's a list!
Exemplo n.º 16
0
from Testing import ZopeTestCase

# Import dummy content to enable registration for tests
import gocept.alphaflow.tests.content

import zope.interface.verify

ZopeTestCase.installProduct("PlacelessTranslationService")
ZopeTestCase.installProduct("SiteAccess")
ZopeTestCase.installProduct("BTreeFolder2")
ZopeTestCase.installProduct("ZCatalog")
ZopeTestCase.installProduct("gocept.alphaflow")
ZopeTestCase.installProduct("PloneTestCase")
ZopeTestCase.installProduct("Five")

PloneTestCase.setupPloneSite(products=('gocept.alphaflow', ))

from gocept.alphaflow.interfaces import IWorkflowImporter
from gocept.alphaflow.process import Process

from gocept.alphaflow.utils import mailhostTestingModePatch
mailhostTestingModePatch()

from gocept.alphaflow import config
config.ENABLE_ZODB_COMMITS = False


class AlphaFlowTestCase(PloneTestCase.FunctionalTestCase):
    '''AlphaFlow testcase'''

    _add_members = [('author', (), 'Hans Wurst'),
Exemplo n.º 17
0
from Testing import ZopeTestCase

# Import dummy content to enable registration for tests
import Products.AlphaFlow.tests.content

import zope.interface.verify

ZopeTestCase.installProduct("PlacelessTranslationService")
ZopeTestCase.installProduct("SiteAccess")
ZopeTestCase.installProduct("BTreeFolder2")
ZopeTestCase.installProduct("ZCatalog")
ZopeTestCase.installProduct("AlphaFlow")
ZopeTestCase.installProduct("PloneTestCase")
ZopeTestCase.installProduct("Five")

PloneTestCase.setupPloneSite(products=('AlphaFlow', ))

from Products.AlphaFlow.interfaces import IWorkflowImporter
from Products.AlphaFlow.process import Process

from Products.AlphaFlow.utils import mailhostTestingModePatch
mailhostTestingModePatch()

from Products.AlphaFlow import config
config.ENABLE_ZODB_COMMITS = False


class AlphaFlowTestCase(PloneTestCase.FunctionalTestCase):
    '''AlphaFlow testcase'''

    _add_members = [('author', (), 'Hans Wurst'),
Exemplo n.º 18
0

@onsetup
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneFormGen)
    if haveRecaptcha:
        zcml.load_config('configure.zcml', collective.recaptcha)
    fiveconfigure.debug_mode = False


# Set up the Plone site used for the test fixture. The PRODUCTS are the products
# to install in the Plone site (as opposed to the products defined above, which
# are all products available to Zope in the test fixture)
setup_product()
PloneTestCase.setupPloneSite(products=['PloneFormGen'])


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


from Products.MailHost.MailHost import MailHost


class MailHostMock(MailHost):
    def _send(self, mfrom, mto, messageText, immediate=False):
        print '<sent mail from %s to %s>' % (mfrom, mto)
        self.msgtext = messageText
        self.msg = email.message_from_string(messageText.lstrip())
Exemplo n.º 19
0
 def testIMSTransportInstall(self):
     """ Installation test """
     assert PloneTestCase.hasProduct('IMSTransport'), 'IMSTransport installation failure.'
Exemplo n.º 20
0
import os, sys
if __name__ == '__main__':
    execfile(os.path.join(sys.path[0], 'framework.py'))

from Products.CMFPlone.tests import PloneTestCase
from unittest import TestSuite, makeSuite
from Testing import ZopeTestCase
from Testing.ZopeTestCase import user_name
from AccessControl import Unauthorized

ZopeTestCase.installProduct('IMSTransport')

PloneTestCase.setupPloneSite(products=('IMSTransport',))

class testIMSTransport(PloneTestCase.PloneTestCase):   
    
    def testIMSTransportInstall(self):
        assert PloneTestCase.hasProduct('IMSTransport'), 'IMSTransport failed to install'
        
        
    def testExportImportPackage(self):
        self.setRoles(['Manager'])
        po = self.portal
        it_tool = self.portal.portal_IMSTransportTool

        self.testExportPackage()
        
        po.invokeFactory('Folder','testFolder2')
        test_folder2 = getattr(po, 'testFolder2')       
        it_tool.importZipfile(test_folder2,'var/mydoc.zip','Default')
   
Exemplo n.º 21
0
import os

from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase

# Make sure the dummy types are registered
from Products.CMFBibliographyAT.tests import dummy

# and the types get still registered with the types tool
from Products.GenericSetup import EXTENSION, profile_registry

ZopeTestCase.installProduct('CMFBibliographyAT')
PROFILES = ['Products.CMFBibliographyAT:default']
PloneTestCase.setupPloneSite(extension_profiles=PROFILES)


# This is so we can find our own files
from Products.CMFBibliographyAT.tests import GLOBALS
from App.Common import package_home
PACKAGE_HOME = package_home(GLOBALS)

from os.path import join
MEDLINE_TEST_MED = join(PACKAGE_HOME, 'medline_test.med')
MEDLINE_TEST_BIB = join(PACKAGE_HOME, 'medline_test.bib')
MEDLINE_TEST_XML = join(PACKAGE_HOME, 'medline_test.xml')
BIBTEX_TEST_BIB = join(PACKAGE_HOME, 'bibtex_test.bib')
IDCOOKING_TEST_BIB = join(PACKAGE_HOME, 'idcooking_test.bib')
PDFFOLDER_TEST_BIB = join(PACKAGE_HOME, 'pdffolder_test.bib')
CMFBAT_TEST_PDF_1 = join(PACKAGE_HOME, 'cmfbat-pdffile1.pdf')
CMFBAT_TEST_PDF_2 = join(PACKAGE_HOME, 'cmfbat-pdffile2.pdf')
CMFBAT_TEST_PDF_3 = join(PACKAGE_HOME, 'cmfbat-pdffile3.pdf')
Exemplo n.º 22
0
 def testContentLicensingInstall(self):
     assert PloneTestCase.hasProduct('ContentLicensing'), "ContentLicensing failed to install"
Exemplo n.º 23
0
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneFormGen)
    zcml.load_config('configure.zcml', uwosh.pfg.d2c)
    zcml.load_config('configure.zcml', collective.signupsheet)

    ZopeTestCase.installPackage('uwosh.pfg.d2c')
    ZopeTestCase.installPackage('collective.signupsheet')
    fiveconfigure.debug_mode = False


#Set up the Plone site used for the test fixture. The PRODUCTS are the products
#to install in the Plone site (as opposed to the products defined above, which
#are all products available to Zope in the test fixture)
setup_product()
PloneTestCase.setupPloneSite(products=['PloneFormGen',
                                       'uwosh.pfg.d2c',
                                       'collective.signupsheet'])


def get_file(whichone=''):
    if not whichone:
        return None
    path = os.path.join(os.path.dirname(__file__), 'files/' + whichone)
    return file(path, 'r').readlines()


class FunctionalTestCase(PloneTestCase.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.
    """
# TODO
# replace ../../ with os.cwd
# move files into data subdir

current_dir = os.path.dirname(__file__)
PATH_PREFIX = os.path.join(current_dir, "data")
BAD_FILE = os.path.join(PATH_PREFIX, "bad_atom.xml")
GOOD_FILE = os.path.join(PATH_PREFIX, "good_atom.xml")
EXPECTED_RESULT = os.path.join(PATH_PREFIX, "atom_post_expected_result.xml")

GIF_FILE = {"filename": "beach.gif", "extension": "gif", "content_type": "image/gif"}


ZopeTestCase.installProduct("rhaptos.atompub.plone", quiet=1)
PloneTestCase.setupPloneSite()


class TestAtomPub(PloneTestCase.FunctionalTestCase):
    def afterSetUp(self):
        self.addProfile("rhaptos.atompub.plone:default")
        super(TestAtomPub, self).afterSetUp()

    def testAtomFeedView(self):
        """
        Add a folder and a file.
        Get the atom feed.
        """
        creation_date = DateTime.DateTime()
        contents = "A test file"
#
##############################################################################
"""COREBlog2 tests
"""

__author__ = 'Atsushi Shibata <*****@*****.**>'
__docformat__ = 'plaintext'

from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase
from Acquisition import aq_base
from DateTime import DateTime

from Products.PloneTestCase import PloneTestCase

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

blog_id = 'blog'

entry_body = """
Header
======

Text, text, text

* List
* List
"""

entry_data = (
Exemplo n.º 26
0
from cStringIO import StringIO
from zExceptions import Forbidden
from zope.interface import directlyProvides
from zope import component
from zope.container.interfaces import IObjectRemovedEvent
from Products.CMFPlone.tests import PloneTestCase
from Products.PloneTestCase.setup import default_user
from Products.PloneTestCase.setup import default_password
from Products.CMFPlone.tests.dummy import Item, ICantBeDeleted, \
                                          disallow_delete_handler
import transaction

PloneTestCase.installProduct('SiteAccess', quiet=1)


class TestFolderRename(PloneTestCase.PloneTestCase):
    # Tests for folder_rename and folder_rename_form

    def afterSetUp(self):
        self.catalog = self.portal.portal_catalog
        self.folder.invokeFactory('Folder', id='foo')
        self.folder.invokeFactory('Folder', id='bar')
        self.folder.foo.invokeFactory('Document', id='doc1')
        self.folder.bar.invokeFactory('Document', id='doc2')
        # folder_rename requires a non-GET request
        self.setRequestMethod('POST')
        self.setupAuthenticator()

    def testTitleIsUpdatedOnTitleChange(self):
        # Make sure our title is updated on the object
        title = 'Test Doc - Snooze!'
Exemplo n.º 27
0
#
# This test module demonstrates a problem caused by the removal of
# a few lines of code from cAccessControl.c and ImplPython.c
# See: http://mail.zope.org/pipermail/zope-checkins/2004-August/028152.html
#
# If an object with setDefaultAccess('deny') is used as the context for
# a PythonScript, the script can no longer aquire tools from the portal
# root. Rolling back the abovementioned checkin restores functionality.
#

from Products.CMFPlone.tests import PloneTestCase

PloneTestCase.installProduct('PythonScripts')


from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from OFS.SimpleItem import SimpleItem


class AllowedItem(SimpleItem):
    id = 'allowed'
    security = ClassSecurityInfo()
    security.setDefaultAccess('allow')

InitializeClass(AllowedItem)

class DeniedItem(SimpleItem):
    id = 'denied'
    security = ClassSecurityInfo()
    security.setDefaultAccess('deny')
Exemplo n.º 28
0
# Tests for scripts behind folder_contents view
#

from cStringIO import StringIO
from zExceptions import Forbidden
from zope.interface import directlyProvides
from zope import component
from zope.app.container.interfaces import IObjectRemovedEvent
from Products.CMFPlone.tests import PloneTestCase
from Products.PloneTestCase.setup import default_user
from Products.PloneTestCase.setup import default_password
from Products.CMFPlone.tests.dummy import Item, ICantBeDeleted, \
                                          disallow_delete_handler
import transaction

PloneTestCase.installProduct('SiteAccess', quiet=1)


class TestFolderRename(PloneTestCase.PloneTestCase):
    # Tests for folder_rename and folder_rename_form

    def afterSetUp(self):
        self.catalog = self.portal.portal_catalog
        self.folder.invokeFactory('Folder', id='foo')
        self.folder.invokeFactory('Folder', id='bar')
        self.folder.foo.invokeFactory('Document', id='doc1')
        self.folder.bar.invokeFactory('Document', id='doc2')
        # folder_rename requires a non-GET request
        self.setRequestMethod('POST')

    def testTitleIsUpdatedOnTitleChange(self):
Exemplo n.º 29
0
ZopeTestCase.installProduct('PloneFormGen')

@onsetup
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneFormGen)
    if haveRecaptcha:
        zcml.load_config('configure.zcml', collective.recaptcha)
    fiveconfigure.debug_mode = False

# Set up the Plone site used for the test fixture. The PRODUCTS are the products
# to install in the Plone site (as opposed to the products defined above, which
# are all products available to Zope in the test fixture)
setup_product()
PloneTestCase.setupPloneSite(products=['PloneFormGen'])

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

from Products.MailHost.MailHost import MailHost
class MailHostMock(MailHost):
    def _send(self, mfrom, mto, messageText, immediate=False):
        print '<sent mail from %s to %s>' % (mfrom, mto)
        self.msgtext = messageText
        self.msg = email.message_from_string(messageText.lstrip())

class PloneFormGenTestCase(PloneTestCase.PloneTestCase):
    def _setup(self):
        # make sure we test in Plone 2.5 with the exception hook monkeypatch applied
Exemplo n.º 30
0
from Products.PloneHelpCenter.config import ADD_HELP_AREA_PERMISSION

# from Products.Five.testbrowser import Browser

ZopeTestCase.installProduct('PloneHelpCenter')


@onsetup
def setup_product():
    fiveconfigure.debug_mode = True
    zcml.load_config('configure.zcml', Products.PloneHelpCenter)
    fiveconfigure.debug_mode = False


setup_product()
PloneTestCase.setupPloneSite(products=['PloneHelpCenter'])


class PHCTestCase(PloneTestCase.PloneTestCase):

    defaultTitle = 'Default Testing Title'
    defaultVersions = ('Version 1.0', 'Version 2.0', 'Different Version1.0')
    defaultBodyRst = """
    Bogus reST body
    ===============

    Here's fake body content for unit tests.

    * Looks like a list.
    * Smells like a list.
    * It's a list!
Exemplo n.º 31
0
import os, sys
if __name__ == '__main__':
    execfile(os.path.join(sys.path[0], 'framework.py'))

from Products.CMFPlone.tests import PloneTestCase
from unittest import TestSuite, makeSuite
from Testing import ZopeTestCase
from Testing.ZopeTestCase import user_name
from AccessControl import Unauthorized

ZopeTestCase.installProduct('PloneBookmarklets')

PloneTestCase.setupPloneSite(products=('PloneBookmarklets',))

class testPloneBookmarklets(PloneTestCase.PloneTestCase):
    def testPloneBookmarkletsInstall(self):
        assert PloneTestCase.hasProduct('PloneBookmarklets'), "PloneBookmarklets failed to install"

    def testPloneBookmarkletsGetSites(self):
	pb_tool = self.portal.portal_bookmarklets
 	assert len(pb_tool.getSites()) == len(pb_tool.AvailableSites), "PloneBookmarklets getSites() failed"

    def testPloneBookmarkletsLoggedIn(self):
        self.assertRaises(Unauthorized, self.portal.portal_bookmarklets.restrictedTraverse, 'manage_overview')
        

def test_suite():
    suite = TestSuite()
    suite.addTest(makeSuite(testPloneBookmarklets))
    return suite
Exemplo n.º 32
0
from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase
from unittest import TestCase, TestSuite, makeSuite, main
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.UWOshOIE.Extensions.Settings.EmailTemplates import *
from Products.UWOshOIE.Extensions.Settings.Helpers import create_settings_documents

# These must install cleanly
ZopeTestCase.installProduct('ATVocabularyManager')
ZopeTestCase.installProduct('UWOshOIE')

# Set up the Plone site used for the test fixture. The PRODUCTS are the products
# to install in the Plone site (as opposed to the products defined above, which
# are all products available to Zope in the test fixture)
PRODUCTS = ['ATVocabularyManager', 'UWOshOIE']
PloneTestCase.setupPloneSite(products=PRODUCTS)

class MockMailHost:
    """
    Fake MailHost so we don't have problem when scripts try to send mail
    """
    def __init__(self, *args, **kwargs):
        self.to = []
        self.fromWho = []
        self.message = []
        self.subject = []
        self.count = 0

    def secureSend(self, mMsg, mTo, mFrom, mSubj):
        self.to.append(mTo)
        self.fromWho.append(mFrom)
Exemplo n.º 33
0
 def testContentLicensingInstall(self):
     # Test that the product is installed correctly
     assert PloneTestCase.hasProduct('ContentLicensing'), "ContentLicensing failed to install"
     # Test that there are 5 default licenses
     self.assertEqual(len(self.clutil.getLicenses(self.portal)), 5)