Exemplo n.º 1
0
 def test_set_bundle(self):
     self.bundle_names.append('bundle-for-portal-test')
     bundle = bundles.get('bundle-for-portal-test')
     portal = NySite('portal')
     portal.set_bundle(bundle)
     ob = MyClass()
     bundle.registerUtility(ob)
     portal_site_manager = portal.getSiteManager()
     self.assertTrue(portal_site_manager.getUtility(ITestUtil) is ob)
Exemplo n.º 2
0
 def setUp(self):
     from Products.Naaya.interfaces import INySite
     from Products.Naaya.NySite import NySite
     from naaya.core.interfaces import IFilesystemBundleFactory
     from naaya.core.fsbundles import register_bundle_factory
     self.bundle_names = []
     self.tmp = tempfile.mkdtemp()
     register_bundle_factory(self.tmp, 'FooSites-', 'Foo')
     self.site = NySite('bar')
     self.site.set_bundle(bundles.get('Foo'))
Exemplo n.º 3
0
    def add_portal(self):
        try:
            from Products.Naaya.NySite import NySite
        except ImportError:
            self.portal = self.app
            return

        self.app._setObject('portal', NySite(
            'portal', 'portal', 'Naaya Test Site', 'en'))
        self.portal = getattr(self.app, 'portal')
Exemplo n.º 4
0
 def test_process_querystring(self):
     site = NySite('test')
     arg_expected = [
         ('', ''),
         ('x', ''),
         ('x=oops', 'x=oops'),
         ('x=oops&skey=&rkey=23', 'x=oops'),
         ('x=&skey=&rkey=23', ''),
         ('start=zz&skey=34&rkey=23&m=&n=oops', 'n=oops'),
         ('m=once&f&start=zz&rkey=1&x=again&n=oops', 'm=once&x=again&n=oops')
     ]
     for arg, expected in arg_expected:
         self.assertEqual(site.process_querystring(arg), expected)
Exemplo n.º 5
0
    def setUp(self):
        from naaya.core.zope2util import getExtConfiguration as getConfiguration
        from Products.Naaya.NySite import NySite

        self.config = getConfiguration()
        self.config_patch = patch.object(self.config,
                                         'environment', {},
                                         create=True)
        self.config_patch.start()

        self.environ_patch = patch.dict(os.environ)
        self.environ_patch.start()

        self.portal = NySite('test-site')
Exemplo n.º 6
0
    def setUp(self):
        from App.config import getConfiguration
        from Products.Naaya.NySite import NySite

        self.config = getConfiguration()
        self.config_patch = patch.object(self.config,
                                         'environment', {},
                                         create=True)
        self.config_patch.start()

        self.environ_patch = patch.dict(os.environ)
        self.environ_patch.start()

        self.portal = NySite('test')
        self.portal.portal_email = EmailTool('id_email_tool',
                                             'Test email tool')

        self.TMP_FOLDER = tempfile.mkdtemp()