예제 #1
0
        def setUp(cls):

            app = ztc.app()
            portal = app.plone

            # change the active local site manager
            setHooks()
            setSite(portal)

            # elevate permissions
            user = portal.getWrappedOwner()
            newSecurityManager(None, user)

            tool = getToolByName(portal, 'portal_quickinstaller')
            product_name = 'quintagroup.plonetabs'
            if tool.isProductInstalled(product_name):
                tool.uninstallProducts([
                    product_name,
                ])

            # drop elevated perms
            noSecurityManager()

            transaction.commit()
            ztc.close(app)
예제 #2
0
    def setUp(cls):
        from pas.plugins.sqlalchemy.model import Base

        testing.setUp()
        # zcml.load_config('meta.zcml', Products.Five)
        # zcml.load_config('configure.zcml', pas.plugins.sqlalchemy)

        app = ZopeTestCase.app()

        # Create our sandbox
        app.manage_addFolder(SANDBOX_ID)
        sandbox = app[SANDBOX_ID]

        # Add a cache manager
        factory = sandbox.manage_addProduct['StandardCacheManagers']
        factory.manage_addRAMCacheManager(CACHE_MANAGER_ID)

        # Setup the DB connection and PAS instances
        factory = EngineFactory('sqlite:///:memory:')
        engine = factory()
        Base.metadata.bind = engine
        Base.metadata.create_all(engine)
        cls.pas = cls.setupPAS(sandbox)

        utility = GloballyScopedSession(bind=engine, twophase=TEST_TWOPHASE)

        component.provideUtility(utility,
                                 provides=IScopedSession,
                                 name="pas.plugins.sqlalchemy")

        transaction.commit()
        ZopeTestCase.close(app)
예제 #3
0
 def tearDown(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     reg = BasePloneWickedRegistration(plone)
     reg.handle(unregister=True)
     txn.commit()
     ZopeTestCase.close(app)
예제 #4
0
파일: basetestcase.py 프로젝트: dtgit/dtedu
    def setUp(cls):
        testing.setUp()
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('encrypt.zcml', Products.SQLPASPlugin)

        app = ZopeTestCase.app()

        # Create our sandbox
        app.manage_addFolder(SANDBOX_ID)
        sandbox = app[SANDBOX_ID]

        # Add a cache manager
        factory = sandbox.manage_addProduct['StandardCacheManagers']
        factory.manage_addRAMCacheManager(CACHE_MANAGER_ID)

        # Setup the DB connection and PAS instances
        cls.conn = cls.setupConnection(sandbox)
        cls.pas = cls.setupPAS(sandbox)

        # Update PAS to use test tables
        users = cls.pas[USERMANAGER_ID]
        users.manage_changeProperties(users_table=TESTING_USERS_TABLE)
        roles = cls.pas[ROLEMANAGER_ID]
        roles.manage_changeProperties(roles_table=TESTING_ROLES_TABLE)
        props = cls.pas[PROPERTYPROVIDER_ID]
        props.manage_changeProperties(users_table=TESTING_USERS_TABLE)

        # Create the tables tests
        cls.execute(cls.createTable(TESTING_USERS_TABLE,
                                    TESTING_USERS_COLUMNS))
        cls.execute(cls.createTable(TESTING_ROLES_TABLE,
                                    TESTING_ROLES_COLUMNS))

        transaction.commit()
        ZopeTestCase.close(app)
예제 #5
0
 def tearDown(cls):
     testing.tearDown()
     app = ZopeTestCase.app()
     schema.metadata.drop_all()
     app.manage_delObjects( SANDBOX_ID )
     transaction.commit()
     ZopeTestCase.close(app)
예제 #6
0
    def setUp(cls):
        from pas.plugins.sqlalchemy.model import Base

        testing.setUp()
        # zcml.load_config('meta.zcml', Products.Five)
        # zcml.load_config('configure.zcml', pas.plugins.sqlalchemy)

        app = ZopeTestCase.app()

        # Create our sandbox
        app.manage_addFolder(SANDBOX_ID)
        sandbox = app[SANDBOX_ID]

        # Add a cache manager
        factory = sandbox.manage_addProduct['StandardCacheManagers']
        factory.manage_addRAMCacheManager(CACHE_MANAGER_ID)

        # Setup the DB connection and PAS instances
        factory = EngineFactory('sqlite:///:memory:')
        engine = factory()
        Base.metadata.bind = engine
        Base.metadata.create_all(engine)
        cls.pas = cls.setupPAS(sandbox)

        utility = GloballyScopedSession(
            bind=engine,
            twophase=TEST_TWOPHASE)

        component.provideUtility(utility, provides=IScopedSession,
                                 name="pas.plugins.sqlalchemy")

        transaction.commit()
        ZopeTestCase.close(app)
예제 #7
0
 def tearDown(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     reg = BasePloneWickedRegistration(plone)
     reg.handle(unregister=True)
     txn.commit()
     ZopeTestCase.close(app)
예제 #8
0
    def setUp(cls):
        import Products.CMFCalendar
        import Products.CMFDefault
        import Products.DCWorkflow
        import OFS

        zcml.load_config('configure.zcml', Products.CMFCalendar)
        zcml.load_config('configure.zcml', Products.CMFDefault)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        try:
            zcml.load_config('meta.zcml', OFS)
            zcml.load_config('configure.zcml', OFS)
        except IOError:  # Zope <= 2.13.0a2
            pass
        ZopeTestCase.installPackage('OFS')

        app = ZopeTestCase.app()
        addConfiguredSite(app,
                          'site',
                          'Products.CMFDefault:default',
                          snapshot=False,
                          extension_ids=('Products.CMFCalendar:default',
                                         'Products.CMFCalendar:skins_support'))
        transaction.commit()
        ZopeTestCase.close(app)
예제 #9
0
 def tearDown(cls):
     testing.tearDown()
     app = ZopeTestCase.app()
     schema.metadata.drop_all()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
예제 #10
0
        def setUp(cls):
            app = ztc.app()
            portal = app.plone

            def create(container, nr):
                obj = _createObjectByType('Document', container, 'doc.%d' % nr)
                obj.setTitle('Title for %d' % nr)
                obj.setDescription('A long description for %d' % nr)
                obj.setText('This is the <b>HTML</b> text for item with id %d' % nr)
                obj.reindexObject(idxs=('Title', 'Description', 'SearchableText'))

            regular = createNonBTreeFolder('Folder', portal, 'regular')
            unordered = _createObjectByType('Folder', portal, 'unordered')
            unordered.setOrdering(u'unordered')
            ordered = _createObjectByType('Folder', portal, 'ordered')

            @timecall
            def testCreateContentRegular():
                for x in range(SIZE):
                    create(regular, x)
            @timecall
            def testCreateContentUnordered():
                for x in range(SIZE):
                    create(unordered, x)
            @timecall
            def testCreateContentOrdered():
                for x in range(SIZE):
                    create(ordered, x)

            testCreateContentRegular()
            testCreateContentUnordered()
            testCreateContentOrdered()

            commit()
            ztc.close(app)
예제 #11
0
파일: tests.py 프로젝트: CGTIC/Plone_SP
 def setUp(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     for factory in basic_type_regs:
         factory(plone).handle()
     import transaction as txn
     txn.commit()
     ZopeTestCase.close(app)
예제 #12
0
 def setUp(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     for factory in basic_type_regs:
         factory(plone).handle()
     import transaction as txn
     txn.commit()
     ZopeTestCase.close(app)
예제 #13
0
 def tearDown(cls):
     from pas.plugins.sqlalchemy.model import Base
     Session()
     Base.metadata.drop_all()
     testing.tearDown()
     app = ZopeTestCase.app()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
예제 #14
0
 def tearDown(cls):
     from pas.plugins.sqlalchemy.model import Base
     Session()
     Base.metadata.drop_all()
     testing.tearDown()
     app = ZopeTestCase.app()
     app.manage_delObjects(SANDBOX_ID)
     transaction.commit()
     ZopeTestCase.close(app)
예제 #15
0
파일: tests.py 프로젝트: CGTIC/Plone_SP
 def tearDown(cls):
     """thanks to the zcml load, teardown is not an option"""
     import transaction as txn
     app = ZopeTestCase.app()
     plone = app.plone
     for factory in basic_type_regs:
         factory(plone).handle(unregister=True)
     txn.commit()
     ZopeTestCase.close(app)
예제 #16
0
 def tearDown(cls):
     """thanks to the zcml load, teardown is not an option"""
     import transaction as txn
     app = ZopeTestCase.app()
     plone = app.plone
     for factory in basic_type_regs:
         factory(plone).handle(unregister=True)
     txn.commit()
     ZopeTestCase.close(app)
예제 #17
0
 def setUp(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     reg = BasePloneWickedRegistration(plone)
     reg.handle()
     # install the product
     qi = plone.portal_quickinstaller
     qi.installProduct('wicked.atcontent')
     txn.commit()
     ZopeTestCase.close(app)
 def tearDown(cls):
     app = ZopeTestCase.app()
     portal = app.plone
     
     storage = getUtility(IRuleStorage, context=portal)
     for key in list(storage.keys()):
         del storage[key]
     
     commit()
     ZopeTestCase.close(app)
예제 #19
0
 def setUp(cls):
     app = ZopeTestCase.app()
     plone = app.plone
     reg = BasePloneWickedRegistration(plone)
     reg.handle()
     # install the product
     qi = plone.portal_quickinstaller
     qi.installProduct('wicked.atcontent')
     txn.commit()
     ZopeTestCase.close(app)
    def tearDown(cls):
        app = ZopeTestCase.app()
        portal = app.plone

        storage = getUtility(IRuleStorage, context=portal)
        for key in list(storage.keys()):
            del storage[key]

        commit()
        ZopeTestCase.close(app)
예제 #21
0
 def setUp(cls):
     app = ZopeTestCase.app()
     portal = app.plone
     
     portal_setup = portal.portal_setup
     # wait a bit or we get duplicate ids on import
     time.sleep(1)
     portal_setup.runAllImportStepsFromProfile('profile-collective.wtf:testing')
     
     transaction.commit()
     ZopeTestCase.close(app)
예제 #22
0
파일: testing.py 프로젝트: goschtl/zope
    def setUp(cls):
        import Products.CMFDefault
        import Products.DCWorkflow

        zcml.load_config('configure.zcml', Products.CMFDefault)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        app = ZopeTestCase.app()
        addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
                          snapshot=False)
        transaction.commit()
        ZopeTestCase.close(app)
예제 #23
0
    def setUp(cls):
        import Products.CMFDefault
        import Products.DCWorkflow

        zcml.load_config('configure.zcml', Products.CMFDefault)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        app = ZopeTestCase.app()
        addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
                          snapshot=False)
        transaction.commit()
        ZopeTestCase.close(app)
예제 #24
0
파일: base.py 프로젝트: viona/Easyshop
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone

        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)

        utils.createTestEnvironment(portal)

        commit()
        ZopeTestCase.close(app)
예제 #25
0
파일: base.py 프로젝트: Easyshop/Easyshop
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone

        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)

        utils.createTestEnvironment(portal)
        
        commit()
        ZopeTestCase.close(app)
 def setUp(cls):
     
     fiveconfigure.debug_mode = True
     zcml.load_string(zcml_string)
     fiveconfigure.debug_mode = False
     
     app = ZopeTestCase.app()
     portal = app.plone
     
     portal_setup = portal.portal_setup
     portal_setup.runAllImportStepsFromProfile('profile-collective.contentrules.mail:testing')
     
     commit()
     ZopeTestCase.close(app)
예제 #27
0
파일: base.py 프로젝트: Easyshop/Easyshop
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone
        ZopeTestCase.installPackage("easyshop.core")
        ZopeTestCase.installPackage("easyshop.shop")
        ZopeTestCase.installPackage("easyshop.catalog")
        ZopeTestCase.installPackage("easyshop.carts")
        ZopeTestCase.installPackage("easyshop.criteria")
        ZopeTestCase.installPackage("easyshop.customers")
        ZopeTestCase.installPackage("easyshop.discounts")
        ZopeTestCase.installPackage("easyshop.groups")
        ZopeTestCase.installPackage("easyshop.information")
        ZopeTestCase.installPackage("easyshop.kss")
        ZopeTestCase.installPackage("easyshop.login")
        ZopeTestCase.installPackage("easyshop.management")
        ZopeTestCase.installPackage("easyshop.order")
        ZopeTestCase.installPackage("easyshop.payment")
        ZopeTestCase.installPackage("easyshop.shipping")
        ZopeTestCase.installPackage("easyshop.stocks")
        ZopeTestCase.installPackage("easyshop.taxes")

        setup_tool = getToolByName(portal, 'portal_setup')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.core:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.shop:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.catalog:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.carts:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.criteria:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.customers:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.discounts:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.groups:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.information:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.kss:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.login:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.management:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.order:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.payment:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.shipping:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.stocks:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.taxes:default')

        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)

        utils.createTestEnvironment(portal)

        commit()
        ZopeTestCase.close(app)
예제 #28
0
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone
        ZopeTestCase.installPackage("iqpp.easyshop")
        ZopeTestCase.installPackage("easyshop.shop")
        ZopeTestCase.installPackage("easyshop.catalog")
        ZopeTestCase.installPackage("easyshop.carts")
        ZopeTestCase.installPackage("easyshop.criteria")
        ZopeTestCase.installPackage("easyshop.customers")
        ZopeTestCase.installPackage("easyshop.discounts")
        ZopeTestCase.installPackage("easyshop.groups")
        ZopeTestCase.installPackage("easyshop.information")
        ZopeTestCase.installPackage("easyshop.kss")
        ZopeTestCase.installPackage("easyshop.login")
        ZopeTestCase.installPackage("easyshop.management")
        ZopeTestCase.installPackage("easyshop.order")
        ZopeTestCase.installPackage("easyshop.payment")
        ZopeTestCase.installPackage("easyshop.shipping")
        ZopeTestCase.installPackage("easyshop.stocks")
        ZopeTestCase.installPackage("easyshop.taxes")
        
        setup_tool = getToolByName(portal, 'portal_setup')
        setup_tool.runAllImportStepsFromProfile('profile-iqpp.easyshop:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.shop:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.catalog:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.carts:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.criteria:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.customers:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.discounts:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.groups:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.information:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.kss:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.login:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.management:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.order:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.payment:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.shipping:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.stocks:default')
        setup_tool.runAllImportStepsFromProfile('profile-easyshop.taxes:default')

        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)

        utils.createTestEnvironment(portal)
        
        commit()
        ZopeTestCase.close(app)
예제 #29
0
        def setUp(cls):
            fiveconfigure.debug_mode = True
            zcml.load_config('configure.zcml',
                             Products.Gloworm)
            #fiveconfigure.debug_mode = True

            # starting with 2.10.4 product initialization gets delayed for
            # instance startup and is never called when running tests;  hence
            # we have to initialize the package method manually...
            from OFS.Application import install_package
            app = ztc.app()
            install_package(app, Products.Gloworm, Products.Gloworm.initialize)
            # create a starting point for the tests...
            commit()
            ztc.close(app)
예제 #30
0
 def __call__(self, *args, **kw):
     self.app = ZopeTestCase.app()
     try:
         transaction.begin()
         try:
             result = method(*args, **kw)
         except:
             transaction.abort()
             raise
         else:
             transaction.commit()
         return result
     finally:
         ZopeTestCase.close(self.app)
         del self.app
    def setUp(cls):

        fiveconfigure.debug_mode = True
        zcml.load_string(zcml_string)
        fiveconfigure.debug_mode = False

        app = ZopeTestCase.app()
        portal = app.plone

        portal_setup = portal.portal_setup
        portal_setup.runAllImportStepsFromProfile(
            'profile-collective.contentrules.mail:testing')

        commit()
        ZopeTestCase.close(app)
예제 #32
0
    def setUp(cls):
        import Products.CMFCalendar
        import Products.CMFDefault
        import Products.DCWorkflow

        zcml.load_config('configure.zcml', Products.CMFCalendar)
        zcml.load_config('configure.zcml', Products.CMFDefault)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        app = ZopeTestCase.app()
        addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
                          snapshot=False,
                          extension_ids=('Products.CMFCalendar:default',
                                        'Products.CMFCalendar:skins_support'))
        transaction.commit()
        ZopeTestCase.close(app)
예제 #33
0
파일: base.py 프로젝트: kroman0/products
        def setUp(cls):
            app = ztc.app()
            portal = app.plone

            # elevate permissions
            user = portal.getWrappedOwner()
            newSecurityManager(None, user)

            tool = getToolByName(portal, 'portal_quickinstaller')
            if tool.isProductInstalled(PRODUCT):
                tool.uninstallProducts([PRODUCT,])

            # drop elevated perms
            noSecurityManager()

            transaction.commit()
            ztc.close(app)
예제 #34
0
        def setUp(cls):
            app = ztc.app()
            portal = app.plone
            
            # elevate permissions
            user = portal.getWrappedOwner()
            newSecurityManager(None, user)

            tool = getToolByName(portal, 'portal_quickinstaller')
            product_name = 'quintagroup.ploneformgen.readonlystringfield'
            if tool.isProductInstalled(product_name):
                tool.uninstallProducts([product_name,])
            
            # drop elevated perms
            noSecurityManager()
            
            transaction.commit()
            ztc.close(app)
예제 #35
0
    def setUp( cls ):
        testing.setUp()
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('configure.zcml', bungeni.plonepas )

        app = ZopeTestCase.app()

        # Create our sandbox
        app.manage_addFolder(SANDBOX_ID)
        sandbox = app[SANDBOX_ID]
        
        # Setup the DB connection and PAS instances
        db = rdb.create_engine('sqlite://')
        schema.metadata.bind = db
        schema.metadata.create_all()
        cls.pas = cls.setupPAS(sandbox)

        transaction.commit()
        ZopeTestCase.close(app)
예제 #36
0
    def setUp(cls):
        testing.setUp()
        zcml.load_config('meta.zcml', Products.Five)
        zcml.load_config('configure.zcml', bungenicms.plonepas)

        app = ZopeTestCase.app()

        # Create our sandbox
        app.manage_addFolder(SANDBOX_ID)
        sandbox = app[SANDBOX_ID]

        # Setup the DB connection and PAS instances
        db = rdb.create_engine('sqlite://')
        schema.metadata.bind = db
        schema.metadata.create_all()
        cls.pas = cls.setupPAS(sandbox)

        transaction.commit()
        ZopeTestCase.close(app)
예제 #37
0
        def setUp(cls):
            app = ztc.app()
            portal = app.plone

            # elevate permissions
            user = portal.getWrappedOwner()
            newSecurityManager(None, user)

            tool = getToolByName(portal, 'portal_quickinstaller')
            product_name = 'kg.locationfield'
            if tool.isProductInstalled(product_name):
                tool.uninstallProducts([
                    product_name,
                ])

            # drop elevated perms
            noSecurityManager()

            transaction.commit()
            ztc.close(app)
예제 #38
0
파일: basetestcase.py 프로젝트: dtgit/dtedu
    def tearDown(cls):
        testing.tearDown()
        app = ZopeTestCase.app()

        # Remove the tables tests
        cls.execute('DROP TABLE %s' % TESTING_USERS_TABLE)
        cls.execute('DROP TABLE %s' % TESTING_ROLES_TABLE)

        # Remove our sandbox
        app.manage_delObjects(SANDBOX_ID)

        # Remove the testing sqlite database, if existing
        dbFile = 'sqlpasplugin-testing.db'
        dbDir = os.path.join(os.getenv('INSTANCE_HOME'), 'var', 'sqlite')
        dbPath = os.path.join(dbDir, dbFile)
        if os.path.exists(dbDir):
            os.remove(dbPath)

        transaction.commit()
        ZopeTestCase.close(app)
예제 #39
0
파일: base.py 프로젝트: Easyshop/Easyshop
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone
        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)
        zcml.load_config('configure.zcml', easyshop.carts)
        zcml.load_config('configure.zcml', relations)        

        portal.invokeFactory("EasyShop", 'shop', title="EasyShop")
        portal.portal_workflow.doActionFor(portal.shop, "publish")
        portal.shop.at_post_create_script()
        
        portal.shop.products.invokeFactory("Product", 'product', title="Product")
        portal.portal_workflow.doActionFor(portal.shop.products.product, "publish")

        portal.product = portal.shop.products.product
        
        commit()
        ZopeTestCase.close(app)
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)
예제 #41
0
        def setUp(cls):
            app = ztc.app()
            portal = app.plone

            def create(container, nr):
                obj = _createObjectByType('Document', container, 'doc.%d' % nr)
                obj.setTitle('Title for %d' % nr)
                obj.setDescription('A long description for %d' % nr)
                obj.setText(
                    'This is the <b>HTML</b> text for item with id %d' % nr)
                obj.reindexObject(idxs=('Title', 'Description',
                                        'SearchableText'))

            regular = createNonBTreeFolder('Folder', portal, 'regular')
            unordered = _createObjectByType('Folder', portal, 'unordered')
            unordered.setOrdering(u'unordered')
            ordered = _createObjectByType('Folder', portal, 'ordered')

            @timecall
            def testCreateContentRegular():
                for x in range(SIZE):
                    create(regular, x)

            @timecall
            def testCreateContentUnordered():
                for x in range(SIZE):
                    create(unordered, x)

            @timecall
            def testCreateContentOrdered():
                for x in range(SIZE):
                    create(ordered, x)

            testCreateContentRegular()
            testCreateContentUnordered()
            testCreateContentOrdered()

            commit()
            ztc.close(app)
예제 #42
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)
예제 #43
0
    def setUp(cls):
        fiveconfigure.debug_mode = True
        zcml.load_string(zcml_string)
        fiveconfigure.debug_mode = False

        app = ZopeTestCase.app()
        portal = app.plone

        # elevate permissions
        from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
        user = portal.getWrappedOwner()
        newSecurityManager(None, user)

        portal_setup = portal.portal_setup

        portal_setup.runAllImportStepsFromProfile('profile-Products.PloneFormGen:testing')

        # drop elevated perms
        noSecurityManager()

        commit()
        ZopeTestCase.close(app)
예제 #44
0
        def setUp(cls):

            app = ztc.app()
            portal = app.plone

            # change the active local site manager
            setHooks()
            setSite(portal)

            # elevate permissions
            user = portal.getWrappedOwner()
            newSecurityManager(None, user)

            tool = getToolByName(portal, 'portal_quickinstaller')
            product_name = 'quintagroup.plonetabs'
            if tool.isProductInstalled(product_name):
                tool.uninstallProducts([product_name, ])

            # drop elevated perms
            noSecurityManager()

            transaction.commit()
            ztc.close(app)
    def setUp(cls):
        fiveconfigure.debug_mode = True
        zcml.load_string(zcml_string)
        fiveconfigure.debug_mode = False

        app = ZopeTestCase.app()
        portal = app.plone

        # elevate permissions
        from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
        user = portal.getWrappedOwner()
        newSecurityManager(None, user)

        portal_setup = portal.portal_setup

        portal_setup.runAllImportStepsFromProfile(
            'profile-Products.PloneFormGen:testing')

        # drop elevated perms
        noSecurityManager()

        commit()
        ZopeTestCase.close(app)
예제 #46
0
파일: testing.py 프로젝트: CGTIC/Plone_SP
    def setUp(cls):
        import Products.CMFCalendar
        import Products.CMFDefault
        import Products.DCWorkflow
        import OFS

        zcml.load_config('configure.zcml', Products.CMFCalendar)
        zcml.load_config('configure.zcml', Products.CMFDefault)
        zcml.load_config('configure.zcml', Products.DCWorkflow)

        try:
            zcml.load_config('meta.zcml', OFS)
            zcml.load_config('configure.zcml', OFS)
        except IOError:  # Zope <= 2.13.0a2
            pass
        ZopeTestCase.installPackage('OFS')

        app = ZopeTestCase.app()
        addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
                          snapshot=False,
                          extension_ids=('Products.CMFCalendar:default',
                                        'Products.CMFCalendar:skins_support'))
        transaction.commit()
        ZopeTestCase.close(app)
예제 #47
0
파일: base.py 프로젝트: viona/Easyshop
    def setUp(cls):
        app = ZopeTestCase.app()
        portal = app.plone
        # login as admin (copied from `loginAsPortalOwner`)
        uf = app.acl_users
        user = uf.getUserById(PloneTestCase.portal_owner).__of__(uf)
        newSecurityManager(None, user)
        zcml.load_config('configure.zcml', easyshop.carts)
        zcml.load_config('configure.zcml', relations)

        portal.invokeFactory("EasyShop", 'shop', title="EasyShop")
        portal.portal_workflow.doActionFor(portal.shop, "publish")
        portal.shop.at_post_create_script()

        portal.shop.products.invokeFactory("Product",
                                           'product',
                                           title="Product")
        portal.portal_workflow.doActionFor(portal.shop.products.product,
                                           "publish")

        portal.product = portal.shop.products.product

        commit()
        ZopeTestCase.close(app)
예제 #48
0
examples_path = os.path.join(SOFTWARE_HOME, '..', '..', 'skel', 'import',
                             'Examples.zexp')
examples_path = os.path.abspath(examples_path)

# Open ZODB connection
app = ZopeTestCase.app()

# Set up sessioning objects
ZopeTestCase.utils.setupCoreSessions(app)

# Set up example applications
if not hasattr(app, 'Examples'):
    ZopeTestCase.utils.importObjectFromFile(app, examples_path)

# Close ZODB connection
ZopeTestCase.close(app)


class DummyOrder:
    '''Construct an order we can add to the cart'''
    __allow_access_to_unprotected_subobjects__ = 1

    def __init__(self, id, quantity):
        self.id = id
        self.quantity = quantity


class TestShoppingCart(ZopeTestCase.ZopeTestCase):
    '''Test the ShoppingCart example application'''

    _setup_fixture = 0  # No default fixture
예제 #49
0
 def setUp(cls):
     app = ZopeTestCase.app()
     app.LAYER_EXTRACTED = True
     transaction.commit()
     ZopeTestCase.close(app)
예제 #50
0
 def tearDown(cls):
     app = ZopeTestCase.app()
     delattr(app, 'LAYER_EXTRACTED')
     transaction.commit()
     ZopeTestCase.close(app)
예제 #51
0
파일: testcase.py 프로젝트: CGTIC/Plone_SP
 def tearDown(self):
     transaction.abort()
     ZopeTestCase.close(self.app)
from Products.Five import fiveconfigure
from Testing import ZopeTestCase as ztc

from Products.Archetypes.tests.utils import makeContent
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import PloneSite
from Products.PloneTestCase.layer import onsetup
from Products.PloneTestCase.setup import default_user
from Products.PloneTestCase.setup import default_password

from archetypes.referencebrowserwidget.config import WITH_SAMPLE_TYPES

# setup session
app = ztc.app()
ztc.utils.setupCoreSessions(app)
ztc.close(app)


@onsetup
def setup_sample_types():
    # setup sample types
    if not WITH_SAMPLE_TYPES:
        # if WITH_SAMPLE_TYPES is True the the profile is registered in
        # __init__.py already
        from Products.GenericSetup import EXTENSION, profile_registry
        profile_registry.registerProfile(
            'referencebrowserwidget_sampletypes',
            'ReferenceBrowserWidget Sample Content Types',
            'Extension profile including referencebrowserwidget sample content types',
            'profiles/sample_types', 'archetypes.referencebrowserwidget',
            EXTENSION)
예제 #53
0
파일: testcase.py 프로젝트: bendavis78/zope
 def tearDown(self):
     transaction.abort()
     ZopeTestCase.close(self.app)
예제 #54
0
파일: testcase.py 프로젝트: bendavis78/zope
 def tearDown(self):
     transaction.abort()
     ZopeTestCase.close(self.app)
     noSecurityManager()
     setSecurityPolicy(self._oldPolicy)
예제 #55
0
 def tearDown(self):
     noSecurityManager()
     transaction.abort()
     ZopeTestCase.close(self.app)
     Skinnable.SKINDATA = self._oldSkindata
     cleanUp()
예제 #56
0
#------------------------------------------------------------------------------


# Open ZODB connection
app = ZopeTestCase.app()
        
# Set up sessioning objects
ZopeTestCase.utils.setupCoreSessions(app)
        
# Set up example applications
#if not hasattr(app, 'Examples'):
#    ZopeTestCase.utils.importObjectFromFile(app, examples_path)
        
# Close ZODB connection
ZopeTestCase.close(app)
        
    
#------------------------------------------------------------------------------


class TestBase(ZopeTestCase.ZopeTestCase):

    def dummy_redirect(self, *a, **kw):
        self.has_redirected = a[0]
        if kw:
            print "*** Redirecting to %r + (%s)" % (a[0], kw)
        else:
            print "*** Redirecting to %r" % a[0]
    
    def afterSetUp(self):
예제 #57
0
파일: testing.py 프로젝트: bendavis78/zope
 def tearDown(cls):
     app = ZopeTestCase.app()
     app._delObject('site')
     transaction.commit()
     ZopeTestCase.close(app)
예제 #58
0
 def finish(self):
     transaction.commit()
     ZopeTestCase.close(self.app)