def _makeSite(self, expected_container):
     from zope.site.site import SiteManagerContainer
     from zope.site.testing import siteSetUp, createSiteManager
     class DummySite(SiteManagerContainer):
         def restrictedTraverse(*args):
             return expected_container
     siteSetUp()
     site = DummySite()
     createSiteManager(site, setsite=True)
     return site
Exemplo n.º 2
0
 def setUp(self):
     site = siteSetUp(True)
     hooks.setSite(site)
     zope.component.provideAdapter(AbsoulteURLStub, (None, None),
         IAbsoluteURL)
     zope.component.provideAdapter(CheckerStub, (None, None, None, None,
         None), interfaces.ISelectedChecker)
Exemplo n.º 3
0
def setUp(test):
    root = siteSetUp(True)
    test.globs['root'] = root

    zope.component.provideAdapter(
        zope.traversing.adapters.DefaultTraversable,
        [None],
        )

    # setup widgets
    zope.component.provideAdapter(zope.formlib.textwidgets.TextWidget,
        [zope.schema.interfaces.ITextLine, IBrowserRequest],
        zope.formlib.interfaces.IInputWidget)

    zope.component.provideAdapter(
        zope.formlib.exception.WidgetInputErrorView,
        [zope.formlib.interfaces.IWidgetInputError,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IWidgetInputErrorView,
        )
    zope.component.provideAdapter(
        zope.formlib.widget.UnicodeDisplayWidget,
        [zope.schema.interfaces.ITextLine,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IDisplayWidget,
        )
    zope.component.provideAdapter(form.render_submit_button, name='render')
Exemplo n.º 4
0
    def test_ctor_implicit_context(self):
        siteSetUp()

        site = BTreeFolder2('site')
        createSiteManager(site, setsite=True)
        root = self._makeOne().context
        site._setOb('portal_resources', root)

        try:
            dir = PersistentResourceDirectory()
            # context should be stored unwrapped
            self.assertTrue(aq_base(root) is dir.context)

            # but re-wrapped during traversal
            traversed = dir['demo']
            self.assertTrue(site in traversed.context.aq_chain)
        finally:
            siteTearDown()
Exemplo n.º 5
0
    def test_ctor_implicit_context(self):
        from zope.site.testing import siteSetUp, createSiteManager, siteTearDown
        siteSetUp()

        site = BTreeFolder2('site')
        createSiteManager(site, setsite=True)
        root = self._makeOne().context
        site._setOb('portal_resources', root)

        from plone.resource.directory import PersistentResourceDirectory
        try:
            dir = PersistentResourceDirectory()
            # context should be stored unwrapped
            self.assertTrue(aq_base(root) is dir.context)

            # but re-wrapped during traversal
            traversed = dir['demo']
            self.assertTrue(site in traversed.context.aq_chain)
        finally:
            siteTearDown()
def setUpRoot(test):
    db = DB()
    conn = db.open()
    dbroot = conn.root()
    dbroot['root'] = root = siteSetUp(True)
    transaction.commit()
    test.globs['root'] = root
    
    zope.component.provideAdapter(SimpleKeyReference)

    sm = root.getSiteManager()
    intids = sm['default']['intids'] = zope.intid.IntIds()
    sm.registerUtility(intids, zope.intid.interfaces.IIntIds)
Exemplo n.º 7
0
def setUp(test):
    root = siteSetUp(True)
    test.globs['root'] = root

    from zope.traversing.testing import setUp
    setUp()

    from zope.browserpage import metaconfigure
    from zope.contentprovider import tales
    metaconfigure.registerType('provider', tales.TALESProviderExpression)

    zope.security.management.newInteraction()
    zope.security.management.getInteraction().add(TestParticipation())
Exemplo n.º 8
0
def setUp(test):
    test.globs = {'root': siteSetUp(True)}

    traversing.setUp()

    from zope.browserpage import metaconfigure
    metaconfigure.registerType('macro', z3c.macro.tales.MacroExpression)

    zope.component.provideAdapter(ObjectCopier, (IContained,), IObjectCopier)
    zope.component.provideAdapter(ObjectMover, (IContained,), IObjectMover)
    zope.component.provideAdapter(ContainerItemRenamer, (IContainer,),
        IContainerItemRenamer)

    zope.component.provideAdapter(PrincipalClipboard, (IAnnotations,),
        IPrincipalClipboard)
    # use None as principal
    zope.component.provideAdapter(PrincipalAnnotations, (None,),
        IAnnotations)

    # dublin core stub adapter
    zope.component.provideAdapter(z3c.table.testing.DublinCoreAdapterStub)

    # value adapter
    zope.component.provideAdapter(z3c.contents.value.SearchableValues)
Exemplo n.º 9
0
def setUp(test):
    testing.siteSetUp()
Exemplo n.º 10
0
def setUp(test=None):
    siteSetUp()
Exemplo n.º 11
0
def setUp(test):
    site = siteSetUp(site=True)
    test.globs['root'] = site
    provideAdapter(annotations)
    provideAdapter(annotations, (IPrincipal, Interface))
def setUp(test):
    site = siteSetUp(site=True)
    test.globs['root'] = site
    xmlconfig.file('configure.zcml', zope.principalannotation)
Exemplo n.º 13
0
def setUp(test):
    test.globs['root'] = siteSetUp(site=True)
    setUpPasswordManagers()
Exemplo n.º 14
0
def setUpRoot(test):
    root = siteSetUp(True)
    test.globs['root'] = root
Exemplo n.º 15
0
 def setUp(self):
     self.root = siteSetUp(True)
     self.container = testing.Container()
     self.root["container"] = self.container
     zope.traversing.testing.setUp()
Exemplo n.º 16
0
def setUp(test=None):
    siteSetUp()
Exemplo n.º 17
0
 def setUp(self):
     self.sm = testing.siteSetUp(True)
Exemplo n.º 18
0
def setUp(test):
    testing.siteSetUp()
Exemplo n.º 19
0
def setUp(test):
    test.globs['root'] = siteSetUp(True)
    zope.traversing.testing.setUp()
    zope.component.provideAdapter(DublinCoreAdapterStub)
    setUpAdapters()