[Zope3-checkins] CVS: Zope3/src/zope/app/publication/tests - test_zopepublication.py:1.1.2.7

Sidnei da Silva sidnei@x3ng.com.br
Tue, 24 Dec 2002 10:22:24 -0500


Update of /cvs-repository/Zope3/src/zope/app/publication/tests
In directory cvs.zope.org:/tmp/cvs-serv27429/publication/tests

Modified Files:
      Tag: NameGeddon-branch
	test_zopepublication.py 
Log Message:
Remove testing prefix from some modules to make the testrunner happy.

=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.1.2.6 => 1.1.2.7 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.1.2.6	Tue Dec 24 07:51:10 2002
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py	Tue Dec 24 10:21:53 2002
@@ -36,6 +36,39 @@
 from zope.app.publication.browser import BrowserPublication
 from zope.app.publication.traversers import TestTraverser
 
+from zope.interface.verify import verifyClass
+from zope.interface.implements import instancesOfObjectImplements
+
+from zodb.storage.mapping import DB
+
+from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.component.adapter import provideAdapter
+
+from zope.interfaces.i18n import IUserPreferredCharsets
+
+from zope.publisher.base import TestPublication
+from zope.publisher.http import IHTTPRequest
+from zope.publisher.http import HTTPCharsets
+
+from zope.security import simplesecuritypolicies
+from zope.security.securitymanagement import setSecurityPolicy
+
+from zope.app.security.registries.principalregistry import principalRegistry
+from zope.app.interfaces.security \
+     import IUnauthenticatedPrincipal
+
+from zope.app.publication.zopepublication import ZopePublication
+
+from zope.app.content.folder import Folder
+from zope.app.content.folder import RootFolder
+
+from zope.component.interfaces import IServiceService
+
+from zope.publisher.base import TestRequest
+
+from zope.component.service import serviceManager
+
+from transaction import get_transaction
 
 def foo():
     " "
@@ -58,7 +91,47 @@
     __implements__ = DummyPublished.__implements__, BrowserView.__implements__
 
 
-class BasePublicationTests(BasePublicationTests_):
+class BasePublicationTests(PlacelessSetup, unittest.TestCase):
+    klass = ZopePublication
+
+    def setUp(self):
+        PlacelessSetup.setUp(self)
+        provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
+        self.policy = setSecurityPolicy(
+            simplesecuritypolicies.PermissiveSecurityPolicy()
+            )
+        self.db = DB("foo")
+
+        connection = self.db.open()
+        root = connection.root()
+        app = getattr(root, ZopePublication.root_name, None)
+
+        if app is None:
+            from zope.app.content.folder import RootFolder
+
+            app = RootFolder()
+            root[ZopePublication.root_name] = app
+
+            get_transaction().commit()
+
+        connection.close()
+
+        from zope.app.traversing.namespaces import provideNamespaceHandler
+        from zope.app.traversing.presentationnamespaces import view, resource
+        from zope.app.traversing.etcnamespace import etc
+        provideNamespaceHandler('view', view)
+        provideNamespaceHandler('resource', resource)
+        provideNamespaceHandler('etc', etc)
+
+    def tearDown(self):
+        setSecurityPolicy(self.policy) # XXX still needed?
+        PlacelessSetup.tearDown(self)
+
+    def testInterfacesVerify(self):
+        for interface in instancesOfObjectImplements(self.klass):
+            verifyClass(interface, TestPublication)
+
+class BaseBrowserPublicationTests(BasePublicationTests):
 
     def _createRequest(self, path, publication, **kw):
         request = TestRequest(PATH_INFO=path, **kw)
@@ -66,7 +139,7 @@
         return request
 
 
-class BrowserDefaultTests(BasePublicationTests):
+class BrowserDefaultTests(BaseBrowserPublicationTests):
     """
     test browser default
 
@@ -158,7 +231,7 @@
     __implements__ = I1
 
 
-class BrowserPublicationTests(BasePublicationTests):
+class BrowserPublicationTests(BaseBrowserPublicationTests):
 
     klass = BrowserPublication
 
@@ -289,93 +362,6 @@
         app = r.publication.getApplication(r)
         self.assertEqual(app, applicationControllerRoot)
 
-
-def test_suite():
-    t2 = unittest.makeSuite(BrowserPublicationTests, 'test')
-    t3 = unittest.makeSuite(BrowserDefaultTests, 'test')
-    return unittest.TestSuite((t2, t3))
-
-
-if __name__ == '__main__':
-    unittest.TextTestRunner().run( test_suite() )
-
-
-import unittest
-
-from zope.interface.verify import verifyClass
-from zope.interface.implements import instancesOfObjectImplements
-
-from zodb.storage.mapping import DB
-
-from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.component.adapter import provideAdapter
-
-from zope.interfaces.i18n import IUserPreferredCharsets
-
-from zope.publisher.base import TestPublication
-from zope.publisher.http import IHTTPRequest
-from zope.publisher.http import HTTPCharsets
-
-from zope.security import simplesecuritypolicies
-from zope.security.securitymanagement import setSecurityPolicy
-
-from zope.app.security.registries.principalregistry import principalRegistry
-from zope.app.interfaces.security \
-     import IUnauthenticatedPrincipal
-
-from zope.app.publication.zopepublication import ZopePublication
-
-from zope.app.content.folder import Folder
-from zope.app.content.folder import RootFolder
-
-from zope.component.interfaces import IServiceService
-
-from zope.publisher.base import TestRequest
-
-from zope.component.service import serviceManager
-
-from transaction import get_transaction
-
-class BasePublicationTests(PlacelessSetup, unittest.TestCase):
-    klass = ZopePublication
-
-    def setUp(self):
-        PlacelessSetup.setUp(self)
-        provideAdapter(IHTTPRequest, IUserPreferredCharsets, HTTPCharsets)
-        self.policy = setSecurityPolicy(
-            simplesecuritypolicies.PermissiveSecurityPolicy()
-            )
-        self.db = DB("foo")
-
-        connection = self.db.open()
-        root = connection.root()
-        app = getattr(root, ZopePublication.root_name, None)
-
-        if app is None:
-            from zope.app.content.folder import RootFolder
-
-            app = RootFolder()
-            root[ZopePublication.root_name] = app
-
-            get_transaction().commit()
-
-        connection.close()
-
-        from zope.app.traversing.namespaces import provideNamespaceHandler
-        from zope.app.traversing.presentationnamespaces import view, resource
-        from zope.app.traversing.etcnamespace import etc
-        provideNamespaceHandler('view', view)
-        provideNamespaceHandler('resource', resource)
-        provideNamespaceHandler('etc', etc)
-
-    def tearDown(self):
-        setSecurityPolicy(self.policy) # XXX still needed?
-        PlacelessSetup.tearDown(self)
-
-    def testInterfacesVerify(self):
-        for interface in instancesOfObjectImplements(self.klass):
-            verifyClass(interface, TestPublication)
-
 class Principal:
     def __init__(self, id): self._id = id
     def getId(self): return self._id
@@ -471,8 +457,13 @@
         publication.afterTraversal(request, ob)
         self.assertEqual(request.user.getId(), 'test.bob')
 
+
 def test_suite():
-    return unittest.makeSuite(ZopePublicationTests)
+    t2 = unittest.makeSuite(BrowserPublicationTests, 'test')
+    t3 = unittest.makeSuite(BrowserDefaultTests, 'test')
+    t4 = unittest.makeSuite(ZopePublicationTests)
+    return unittest.TestSuite((t2, t3, t4))
+
 
 if __name__ == '__main__':
     unittest.TextTestRunner().run( test_suite() )