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, '')
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)
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()
def setUp(test): placelesssetup.setUp() testing.setUp() endInteraction() principal = principalregistry.UnauthenticatedPrincipal('anon','anon','') component.provideUtility( principal, IFallbackUnauthenticatedPrincipal) component.provideUtility( principalregistry.principalRegistry, IAuthentication)
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
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
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)
def setUpTraversal(): from zope.traversing.testing import setUp setUp() provideAdapter(ContainerTraversable, (ISimpleReadContainer, ), ITraversable)
def setUpZPT(suite): setUp(suite)
def setUp(test): testing.setUp(test) # Traversal Setup from zope.traversing.testing import setUp setUp() test.globs['root'] = object()