Exemple #1
0
def setUp(test):
    placelesssetup.setUp(test)
    testing.setUp()
    component.provideAdapter(view, (None, None), ITraversable, name="view")

    component.provideUtility(
        fileresource.filefactory, IResourceFactoryType)
    component.provideUtility(
        fileresource.filefactory, IResourceFactoryType, name='fileresource')
    component.provideUtility(
        fileresource.imagefactory, IResourceFactoryType, name='imageresource')
    component.provideUtility(
        zrtresource.zrtfactory, IResourceFactoryType, name='zrt')

    component.provideAdapter(
        fileresource.FileResourceAdapter, (FileResource,))

    component.provideUtility(
        command.cssregistry_factory, IZRTCommandFactory, 'cssregistry')

    registry = CSSRegistry()
    registry['fontColor']= property.Property('fontColor', '#11111111')
    registry['fontFamily']= property.Property('fontFamily', 'Verdana')

    component.provideAdapter(
        zcml.Factory(registry),
        (interfaces.ICSSRegistryLayer, interfaces.ICSSRegistryLayer,
         interface.Interface), interfaces.ICSSRegistry, '')
Exemple #2
0
def setUp(test):
    root = setup.placefulSetUp(site=True)
    testing.setUp()

    provideAdapter(connectionOfPersistent, (IPersistent,), IConnection)
    provideAdapter(KeyReferenceToPersistent, (IPersistent,), IKeyReference)

    utility = IntIds()
    provideUtility(utility, IIntIds)

    root._p_jar = ConnectionStub()

    root['folder1'] = Folder()
    root['folder1']['folder1_1'] = Folder()
    root['folder1']['folder1_1']['folder1_1_1'] = Folder()

    root['folder2'] = Folder()
    root['folder2']['folder2_2'] = Folder()
    root['folder2']['folder2_2']['folder2_2_2'] = Folder()

    utility.register(root)
    utility.register(root['folder1'])
    utility.register(root['folder1']['folder1_1'])
    utility.register(root['folder1']['folder1_1']['folder1_1_1'])
    utility.register(root['folder2'])
    utility.register(root['folder2']['folder2_2'])
    utility.register(root['folder2']['folder2_2']['folder2_2_2'])
    test.globs['root'] = root
def setUpTraversal():
    "Make simple read containers traversable."
    from zope.traversing.testing import setUp
    setUp()
    component.provideAdapter(ContainerTraversable,
                             (ISimpleReadContainer,),
                             ITraversable)
Exemple #4
0
def setUpZ3CPT(suite):
    setUp(suite)
    xmlconfig.XMLConfig('configure.zcml', z3c.pt)()
    xmlconfig.XMLConfig('configure.zcml', z3c.ptcompat)()

    # We have to cook this template explicitly, because it's a module
    # global.
    z3c.template.template.Macro.wrapper._cook()
Exemple #5
0
def setUp(test):
    placelesssetup.setUp()
    testing.setUp()

    endInteraction()

    principal = principalregistry.UnauthenticatedPrincipal('anon','anon','')
    component.provideUtility(
        principal, IFallbackUnauthenticatedPrincipal)
    component.provideUtility(
        principalregistry.principalRegistry, IAuthentication)
Exemple #6
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())
    def setUp(self):
        ZCMLFileLayer.setUp(self)

        # Set up site manager adapter
        zope.component.provideAdapter(
            SiteManagerAdapter, (Interface,), IComponentLookup)

        # Set up traversal
        setUp()
        zope.component.provideAdapter(
            ContainerTraversable, (ISimpleReadContainer,), ITraversable)

        # Set up site
        site = rootFolder()
        site.setSiteManager(LocalSiteManager(site))
        zope.component.hooks.setSite(site)
        return site
def test_suite():
    optionflags = (doctest.ELLIPSIS
                   | doctest.REPORT_NDIFF
                   | doctest.NORMALIZE_WHITESPACE)
    suite = unittest.TestSuite()
    suite.addTest(doctest.DocTestSuite('schooltool.common',
                                       optionflags=optionflags))
    suite.addTest(doctest.DocTestSuite('schooltool.common.inlinept',
                                       optionflags=optionflags,
                                       setUp=lambda test: setUp()))
    suite.addTest(unittest.makeSuite(TestHelpers))
    return suite
Exemple #9
0
def test_suite():
    optionflags = (doctest.ELLIPSIS
                   | doctest.REPORT_NDIFF
                   | doctest.NORMALIZE_WHITESPACE)
    suite = unittest.TestSuite()
    suite.addTest(
        doctest.DocTestSuite('schooltool.common', optionflags=optionflags))
    suite.addTest(
        doctest.DocTestSuite('schooltool.common.inlinept',
                             optionflags=optionflags,
                             setUp=lambda test: setUp()))
    suite.addTest(unittest.makeSuite(TestHelpers))
    return suite
Exemple #10
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)
def setUpTraversal():
    from zope.traversing.testing import setUp
    setUp()
    zope.component.provideAdapter(ContainerTraversable,
                                  (ISimpleReadContainer,), ITraversable)
def setUp(test):
    cleanup.setUp()
    testing.setUp()
    zope.component.provideAdapter(view, (None, None), ITraversable, name="view")
    zope.component.provideAdapter(zope.browserresource.file.FileETag)
Exemple #13
0
def setUpTraversal():
    from zope.traversing.testing import setUp
    setUp()
    provideAdapter(ContainerTraversable, (ISimpleReadContainer, ),
                   ITraversable)
Exemple #14
0
def setUpZPT(suite):
    setUp(suite)
Exemple #15
0
def setUp(test):
    testing.setUp(test)
    # Traversal Setup
    from zope.traversing.testing import setUp
    setUp()
    test.globs['root'] = object()