[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testDefaultTraverser.py:1.1.2.5 testZopePublication.py:1.1.2.16
Stephan Richter
srichter@cbu.edu
Wed, 27 Mar 2002 10:05:09 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv32058/tests
Modified Files:
Tag: Zope-3x-branch
testDefaultTraverser.py testZopePublication.py
Log Message:
- XML-RPC support
- security
- ZCML cleanup
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testDefaultTraverser.py 1.1.2.4 => 1.1.2.5 ===
-#
-# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
-#
-##############################################################################
-"""
-
-$Id$
-"""
-
-import unittest, sys
-from Zope.ComponentArchitecture.tests.Request import Request
-from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
-from Zope.ComponentArchitecture import provideView
-from Zope.App.ZopePublication.Traversers import DefaultTraverser
-from Interface import Interface
-from Zope.Exceptions import NotFoundError
-
-
-class I(Interface): pass
-
-
-class Container:
-
- def __init__(self, **kw):
-
- for k in kw:
- setattr(self, k , kw[k])
-
-
- def getObject(self, name, default=None):
-
- return getattr(self, name, default)
-
-
-class Request(Request):
-
- def getEffectiveURL(self):
- return ''
-
-
-class View:
-
- def __init__(self, comp):
- self._comp = comp
-
-
-
-class Test(CleanUp, unittest.TestCase):
-
- def testAttr(self):
- """ test container traver """
-
- foo = Container()
- c = Container( foo=foo )
- req = Request( I, '')
-
- T = DefaultTraverser(c)
- self.failUnless(T.publishTraverse(req,'foo') is foo)
-
- self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
-
-
- def testView(self):
- """ test getting a view """
-
-
- foo = Container()
- c = Container( foo=foo )
- req = Request( I, '')
-
- T = DefaultTraverser(c)
- provideView(None , 'foo', I, View)
-
- self.failUnless(T.publishTraverse(req,'foo;view').__class__ is View )
- self.failUnless(T.publishTraverse(req,'foo') is foo)
-
- self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
- self.assertRaises(NotFoundError , T.publishTraverse, req ,
- 'morebar;view')
-
-
-
-def test_suite():
- loader=unittest.TestLoader()
- return loader.loadTestsFromTestCase(Test)
-
-if __name__=='__main__':
- unittest.TextTestRunner().run(test_suite())
+##############################################################################
+# (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+"""
+
+$Id$
+"""
+
+import unittest, sys
+from Zope.ComponentArchitecture.tests.Request import Request
+from Zope.Testing.CleanUp import CleanUp # Base class w registry cleanup
+from Zope.ComponentArchitecture import provideView
+from Zope.App.ZopePublication.Browser.BrowserTraversers import \
+ DefaultTraverser
+from Interface import Interface
+from Zope.Exceptions import NotFoundError
+
+
+class I(Interface): pass
+
+
+class Container:
+
+ def __init__(self, **kw):
+
+ for k in kw:
+ setattr(self, k , kw[k])
+
+
+ def getObject(self, name, default=None):
+
+ return getattr(self, name, default)
+
+
+class Request(Request):
+
+ def getEffectiveURL(self):
+ return ''
+
+
+class View:
+
+ def __init__(self, comp):
+ self._comp = comp
+
+
+
+class Test(CleanUp, unittest.TestCase):
+
+ def testAttr(self):
+ """ test container traver """
+
+ foo = Container()
+ c = Container( foo=foo )
+ req = Request( I, '')
+
+ T = DefaultTraverser(c)
+ self.failUnless(T.publishTraverse(req,'foo') is foo)
+
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
+
+
+ def testView(self):
+ """ test getting a view """
+
+
+ foo = Container()
+ c = Container( foo=foo )
+ req = Request( I, '')
+
+ T = DefaultTraverser(c)
+ provideView(None , 'foo', I, View)
+
+ self.failUnless(T.publishTraverse(req,'foo;view').__class__ is View )
+ self.failUnless(T.publishTraverse(req,'foo') is foo)
+
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,'morebar')
+ self.assertRaises(NotFoundError , T.publishTraverse, req ,
+ 'morebar;view')
+
+
+
+def test_suite():
+ loader=unittest.TestLoader()
+ return loader.loadTestsFromTestCase(Test)
+
+if __name__=='__main__':
+ unittest.TextTestRunner().run(test_suite())
=== Zope3/lib/python/Zope/App/ZopePublication/tests/testZopePublication.py 1.1.2.15 => 1.1.2.16 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -6,6 +9,11 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
+##############################################################################
+"""
+
+$Id$
+"""
import unittest