Пример #1
0
 def getPortal(self):
     # Set up a CMF site.
     try:
         manage_addCMFSite(self.app, CMFTestCase.portal_name)
     except BadRequest:
         pass
     return getattr(self.app, CMFTestCase.portal_name)
Пример #2
0
 def _setupCMFSite_with_portalgenerator(self):
     '''Creates the site using PortalGenerator.'''
     start = time()
     self._print('Adding CMF Site ... ')
     from Products.CMFDefault.Portal import manage_addCMFSite
     manage_addCMFSite(self.app, self.id, create_userfolder=1)
     self._commit()
     self._print('done (%.3fs)\n' % (time()-start,))
Пример #3
0
    def setUp( self ):

        get_transaction().begin()

        # Set up a scratch CMFSite
        app = Zope.app()
        manage_addCMFSite( app, 'testing' )
        self.root = app.testing
Пример #4
0
    def test_manage_addCMFSite_emits_DeprecationWarning( self ):

        # This warning is recorded in *our* globals (stacklevel=2).
        registry = globals().get("__warningregistry__")

        if registry is not None:
            registry.clear()

        # Make a site the old-fashioned way
        from Products.CMFDefault.Portal import manage_addCMFSite
        id = 'emits_warning'
        manage_addCMFSite( self.root, id )
        site = getattr( self.root, id )

        # Check that a warning was raised.
        if registry is None:
            # registry only exists once a warning is generated
            registry = globals().get("__warningregistry__")
        self.assertEqual( len( registry ), 1 )
        message, category, linenoe  = registry.keys()[ 0 ]
        self.failUnless( 'manage_addCMFSite' in message, message )
        self.failUnless( category is DeprecationWarning, category )
Пример #5
0
    def test_manage_addCMFSite_emits_DeprecationWarning( self ):

        # This warning is recorded in *our* globals (stacklevel=2).
        registry = globals().get("__warningregistry__")

        if registry is not None:
            registry.clear()

        # Make a site the old-fashioned way
        from Products.CMFDefault.Portal import manage_addCMFSite
        id = 'emits_warning'
        manage_addCMFSite( self.root, id )
        site = getattr( self.root, id )

        # Check that a warning was raised.
        if registry is None:
            # registry only exists once a warning is generated
            registry = globals().get("__warningregistry__")
        self.assertEqual( len( registry ), 1 )
        message, category, linenoe  = registry.keys()[ 0 ]
        self.failUnless( 'manage_addCMFSite' in message, message )
        self.failUnless( category is DeprecationWarning, category )
Пример #6
0
    def _makeSite( self, id='testsite'):

        from Products.CMFDefault.Portal import manage_addCMFSite
        manage_addCMFSite( self.root, id )
        return getattr( self.root, id )
Пример #7
0
    def _makeSite(self, id='testsite'):

        from Products.CMFDefault.Portal import manage_addCMFSite

        manage_addCMFSite(self.root, id)
        return getattr(self.root, id)