class BasePublicationTests(PlacelessSetup, unittest.TestCase): def setUp(self): super(BasePublicationTests, self).setUp() from zope.security.management import endInteraction endInteraction() self.policy = setSecurityPolicy( simplepolicies.PermissiveSecurityPolicy ) self.storage = DemoStorage('test_storage') self.db = db = DB(self.storage) ztapi.provideUtility(IAuthentication, principalRegistry) connection = db.open() root = connection.root() app = getattr(root, ZopePublication.root_name, None) if app is None: from zope.app.folder import rootFolder app = rootFolder() root[ZopePublication.root_name] = app transaction.commit() connection.close() self.app = app from zope.traversing.namespace import view, resource, etc ztapi.provideNamespaceHandler('view', view) ztapi.provideNamespaceHandler('resource', resource) ztapi.provideNamespaceHandler('etc', etc) self.request = TestRequest('/f1/f2') self.user = Principal('test.principal') self.request.setPrincipal(self.user) from zope.interface import Interface self.presentation_type = Interface self.request._presentation_type = self.presentation_type self.object = object() self.publication = ZopePublication(self.db) def tearDown(self): # Close the request, otherwise a Cleanup object will start logging # messages from its __del__ method at some inappropriate moment. self.request.close() super(BasePublicationTests, self).tearDown() def testInterfacesVerify(self): for interface in implementedBy(ZopePublication): verifyClass(interface, TestPublication)
class BasePublicationTests(PlacelessSetup, unittest.TestCase): def setUp(self): super(BasePublicationTests, self).setUp() from zope.security.management import endInteraction endInteraction() ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets) self.policy = setSecurityPolicy( simplepolicies.PermissiveSecurityPolicy) self.storage = DemoStorage('test_storage') self.db = db = DB(self.storage) ztapi.provideUtility(IAuthentication, principalRegistry) connection = db.open() root = connection.root() app = getattr(root, ZopePublication.root_name, None) if app is None: from zope.app.folder import rootFolder app = rootFolder() root[ZopePublication.root_name] = app transaction.commit() connection.close() self.app = app from zope.traversing.namespace import view, resource, etc ztapi.provideNamespaceHandler('view', view) ztapi.provideNamespaceHandler('resource', resource) ztapi.provideNamespaceHandler('etc', etc) self.request = TestRequest('/f1/f2') self.user = Principal('test.principal') self.request.setPrincipal(self.user) from zope.interface import Interface self.presentation_type = Interface self.request._presentation_type = self.presentation_type self.object = object() self.publication = ZopePublication(self.db) def tearDown(self): # Close the request, otherwise a Cleanup object will start logging # messages from its __del__ method at some inappropriate moment. self.request.close() super(BasePublicationTests, self).tearDown() def testInterfacesVerify(self): for interface in implementedBy(ZopePublication): verifyClass(interface, TestPublication)
class BasePublicationTests(PlacelessSetup, unittest.TestCase): def setUp(self): super(BasePublicationTests, self).setUp() from zope.security.management import endInteraction endInteraction() ztapi.provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets) self.policy = setSecurityPolicy( simplepolicies.PermissiveSecurityPolicy ) self.storage = DemoStorage('test_storage') self.db = db = DB(self.storage) connection = db.open() root = connection.root() app = getattr(root, ZopePublication.root_name, None) if app is None: from zope.app.folder import rootFolder app = rootFolder() root[ZopePublication.root_name] = app transaction.commit() connection.close() self.app = app from zope.app.traversing.namespace import view, resource, etc ztapi.provideNamespaceHandler('view', view) ztapi.provideNamespaceHandler('resource', resource) ztapi.provideNamespaceHandler('etc', etc) self.request = TestRequest('/f1/f2') self.user = Principal('test.principal') self.request.setPrincipal(self.user) from zope.interface import Interface self.presentation_type = Interface self.request._presentation_type = self.presentation_type self.object = object() self.publication = ZopePublication(self.db) def tearDown(self): super(BasePublicationTests, self).tearDown() def testInterfacesVerify(self): for interface in implementedBy(ZopePublication): verifyClass(interface, TestPublication)
class BasePublicationTests(unittest.TestCase): def setUp(self): from zope.security.management import endInteraction endInteraction() self.policy = setSecurityPolicy(simplepolicies.PermissiveSecurityPolicy) self.storage = DemoStorage("test_storage") self.db = db = DB(self.storage) component.provideUtility(principalRegistry, IAuthentication) connection = db.open() root = connection.root() app = getattr(root, ZopePublication.root_name, None) if app is None: from zope.site.folder import rootFolder app = rootFolder() root[ZopePublication.root_name] = app transaction.commit() connection.close() self.app = app from zope.traversing.namespace import view, resource, etc support.provideNamespaceHandler("view", view) support.provideNamespaceHandler("resource", resource) support.provideNamespaceHandler("etc", etc) self.request = TestRequest("/f1/f2") self.user = Principal("test.principal") self.request.setPrincipal(self.user) from zope.interface import Interface self.presentation_type = Interface self.request._presentation_type = self.presentation_type self.object = object() self.publication = ZopePublication(self.db) def tearDown(self): # Close the request, otherwise a Cleanup object will start logging # messages from its __del__ method at some inappropriate moment. self.request.close() cleanUp()
class BasePublicationTests(unittest.TestCase): def setUp(self): from zope.security.management import endInteraction endInteraction() self.policy = setSecurityPolicy( simplepolicies.PermissiveSecurityPolicy) self.storage = DemoStorage('test_storage') self.db = db = DB(self.storage) component.provideUtility(principalRegistry, IAuthentication) connection = db.open() root = connection.root() app = getattr(root, ZopePublication.root_name, None) if app is None: from zope.site.folder import rootFolder app = rootFolder() root[ZopePublication.root_name] = app transaction.commit() connection.close() self.app = app from zope.traversing.namespace import view, resource, etc support.provideNamespaceHandler('view', view) support.provideNamespaceHandler('resource', resource) support.provideNamespaceHandler('etc', etc) self.request = TestRequest('/f1/f2') self.user = Principal('test.principal') self.request.setPrincipal(self.user) from zope.interface import Interface self.presentation_type = Interface self.request._presentation_type = self.presentation_type self.object = object() self.publication = ZopePublication(self.db) def tearDown(self): # Close the request, otherwise a Cleanup object will start logging # messages from its __del__ method at some inappropriate moment. self.request.close() cleanUp()