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

Philipp von Weitershausen philikon at philikon.de
Sun Mar 21 11:59:45 EST 2004


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

Modified Files:
	test_zopepublication.py 
Log Message:
Try to get a location even if the traversed object is an instance method.
It doesn't work always (as for resources, for example), but it works for
what we're interested in: undo log.


=== Zope3/src/zope/app/publication/tests/test_zopepublication.py 1.30 => 1.31 ===
--- Zope3/src/zope/app/publication/tests/test_zopepublication.py:1.30	Sat Mar 20 16:32:50 2004
+++ Zope3/src/zope/app/publication/tests/test_zopepublication.py	Sun Mar 21 11:59:45 2004
@@ -46,7 +46,7 @@
 from zope.app.security.interfaces import IUnauthenticatedPrincipal, IPrincipal
 from zope.app.publication.zopepublication import ZopePublication
 from zope.app.folder import Folder, rootFolder
-from zope.app.location import Location as LocatableObject
+from zope.app.location import Location
 
 class Principal:
     implements(IPrincipal)
@@ -101,6 +101,11 @@
         else:
             return default
 
+class LocatableObject(Location):
+
+    def foo(self):
+        pass
+
 class BasePublicationTests(PlacelessSetup, unittest.TestCase):
 
     def setUp(self):
@@ -411,17 +416,21 @@
         foo.__parent__ = root
         directlyProvides(root, IContainmentRoot)
 
-        self.publication.afterCall(self.request, bar)
-
         from zope.publisher.interfaces import IRequest
         expected_path = "/foo/bar"
         expected_user = "/ " + self.user.id
         expected_request = IRequest.__module__ + '.' + IRequest.getName()
 
+        self.publication.afterCall(self.request, bar)
         txn_info = self.db.undoInfo()[0]
         self.assertEqual(txn_info['location'], expected_path)
         self.assertEqual(txn_info['user_name'], expected_user)
         self.assertEqual(txn_info['request_type'], expected_request)
+
+        # also, assert that we still get the right location when
+        # passing an instance method as object.
+        self.publication.afterCall(self.request, bar.foo)
+        self.assertEqual(txn_info['location'], expected_path)
 
 def test_suite():
     return unittest.TestSuite((




More information about the Zope3-Checkins mailing list