[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests - test_globalbrowsermenuservice.py:1.13

Garrett Smith garrett at mojave-corp.com
Tue Sep 23 21:52:34 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/publisher/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv17653/src/zope/app/publisher/browser/tests

Modified Files:
	test_globalbrowsermenuservice.py 
Log Message:
Fixed a bug that caused the menu service to consider actions with similar
names to be both selected. E.g. 'index.html' and 'foo_index.html' would
both be selected for the URL 'http://localhost/index.html'.

=== Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py:1.12	Fri Aug 15 20:43:51 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py	Tue Sep 23 21:52:33 2003
@@ -168,6 +168,27 @@
             PATH_INFO='/++view++a12'))
         self.assertEqual(list(menu), [d(2), d(12, 'selected'), d(1)])
 
+
+    def test_identify_similar_action(self):
+        r = self.__reg()
+        r.menu('test_id', 'test menu')
+        r.menuItem('test_id', I11, 'aA', 'tA', 'dA')
+        r.menuItem('test_id', I111, 'aAaA', 'tAaA', 'dAaA')
+
+        def d(s, selected=''):
+            return {'action': "a%s" % s,
+                    'title':  "t%s" % s,
+                    'description':  "d%s" % s,
+                    'selected': selected}
+
+        menu = r.getMenu('test_id', TestObject(),
+            TestRequest(SERVER_URL='http://127.0.0.1/aA', PATH_INFO='/aA'))
+        self.assertEqual(list(menu), [d('AaA'), d('A', 'selected')])
+        menu = r.getMenu('test_id', TestObject(), 
+            TestRequest(SERVER_URL='http://127.0.0.1/aAaA', PATH_INFO='/aAaA'))
+        self.assertEqual(list(menu), [d('AaA', 'selected'), d('A')])
+
+
     def testEmpty(self):
         r = self.__reg()
         r.menu('test_id', 'test menu')




More information about the Zope3-Checkins mailing list