[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser/tests -
test_directives.py:1.33 test_globalbrowsermenuservice.py:1.17
test_globalbrowsermenuservicedirectives.py:1.12
Stephan Richter
srichter at cosmos.phy.tufts.edu
Tue Mar 23 17:08:41 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser/tests
In directory cvs.zope.org:/tmp/cvs-serv22597/src/zope/app/publisher/browser/tests
Modified Files:
test_directives.py test_globalbrowsermenuservice.py
test_globalbrowsermenuservicedirectives.py
Log Message:
Rip out usage everywhere.
=== Zope3/src/zope/app/publisher/browser/tests/test_directives.py 1.32 => 1.33 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_directives.py:1.32 Sat Mar 13 16:03:18 2004
+++ Zope3/src/zope/app/publisher/browser/tests/test_directives.py Tue Mar 23 17:08:10 2004
@@ -104,8 +104,6 @@
ztapi.provideAdapter(None, ITraversable, DefaultTraversable)
ps = zapi.getService(None, zapi.servicenames.Presentation)
- ps.defineUsage("objectview")
- ps.defineUsage("overridden")
def testPage(self):
self.assertEqual(queryView(ob, 'test', request),
@@ -128,12 +126,12 @@
def testPageWithClassWithMenu(self):
self.assertEqual(queryView(ob, 'test', request),
None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
+ testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
"""
- <browser:menu id="test_menu" title="Test menu" usage="objectview"/>
+ <browser:menu id="test_menu" title="Test menu" />
<browser:page name="test"
class="zope.app.component.tests.views.V1"
for="zope.app.component.tests.views.IC"
@@ -142,7 +140,7 @@
menu="test_menu"
title="Test View"
/>
- """ % testusage
+ """ % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -150,66 +148,17 @@
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
+ self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
- def testPageWithClassWithUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
- None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
-
-
- xmlconfig(StringIO(template % (
- """
- <browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- usage="objectview"
- />
- """ % testusage
- )))
-
- v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
-
- def testPageWithClassWithMenuAndUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
- None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
-
-
- xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu" usage="overridden"/>
- <browser:page name="test"
- class="zope.app.component.tests.views.V1"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- menu="test_menu"
- title="Test View"
- usage="objectview"
- />
- """ % testusage
- )))
-
- menuItem = globalBrowserMenuService.getFirstMenuItem(
- 'test_menu', ob, TestRequest())
- self.assertEqual(menuItem["title"], "Test View")
- self.assertEqual(menuItem["action"], "@@test")
- v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
def testPageWithTemplateWithMenu(self):
self.assertEqual(queryView(ob, 'test', request),
None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
+ testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
-
xmlconfig(StringIO(template % (
"""
- <browser:menu id="test_menu" title="Test menu" usage="objectview"/>
+ <browser:menu id="test_menu" title="Test menu"/>
<browser:page name="test"
for="zope.app.component.tests.views.IC"
permission="zope.Public"
@@ -217,7 +166,7 @@
menu="test_menu"
title="Test View"
/>
- """ % testusage
+ """ % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -225,64 +174,17 @@
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
+ self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
- def testPageWithTemplateWithUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
- None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
-
-
- xmlconfig(StringIO(template % (
- """
- <browser:page name="test"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- usage="objectview"
- />
- """ % testusage
- )))
-
- v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
-
- def testPageWithTemplateWithMenuAndUsage(self):
- self.assertEqual(queryView(ob, 'test', request),
- None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
-
-
- xmlconfig(StringIO(template % (
- """
- <browser:menu id="test_menu" title="Test menu" usage="overridden"/>
- <browser:page name="test"
- for="zope.app.component.tests.views.IC"
- permission="zope.Public"
- template="%s"
- menu="test_menu"
- title="Test View"
- usage="objectview"
- />
- """ % testusage
- )))
-
- menuItem = globalBrowserMenuService.getFirstMenuItem(
- 'test_menu', ob, TestRequest())
- self.assertEqual(menuItem["title"], "Test View")
- self.assertEqual(menuItem["action"], "@@test")
- v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
def testPageInPagesWithTemplateWithMenu(self):
self.assertEqual(queryView(ob, 'test', request),
None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
-
+ testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
"""
- <browser:menu id="test_menu" title="Test menu" usage="objectview"/>
+ <browser:menu id="test_menu" title="Test menu" />
<browser:pages for="zope.app.component.tests.views.IC"
permission="zope.Public">
<browser:page name="test"
@@ -291,7 +193,7 @@
title="Test View"
/>
</browser:pages>
- """ % testusage
+ """ % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -299,17 +201,18 @@
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
+ self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
+
def testPageInPagesWithClassWithMenu(self):
self.assertEqual(queryView(ob, 'test', request),
None)
- testusage = os.path.join(tests_path, 'testfiles', 'testusage.pt')
+ testtemplate = os.path.join(tests_path, 'testfiles', 'test.pt')
xmlconfig(StringIO(template % (
"""
- <browser:menu id="test_menu" title="Test menu" usage="objectview"/>
+ <browser:menu id="test_menu" title="Test menu" />
<browser:pages for="zope.app.component.tests.views.IC"
class="zope.app.component.tests.views.V1"
permission="zope.Public">
@@ -319,7 +222,7 @@
title="Test View"
/>
</browser:pages>
- """ % testusage
+ """ % testtemplate
)))
menuItem = globalBrowserMenuService.getFirstMenuItem(
@@ -327,7 +230,7 @@
self.assertEqual(menuItem["title"], "Test View")
self.assertEqual(menuItem["action"], "@@test")
v = queryView(ob, 'test', request)
- self.assertEqual(v(), "objectview\n")
+ self.assertEqual(v(), "<html><body><p>test</p></body></html>\n")
def testDefaultView(self):
self.assertEqual(queryView(ob, 'test', request,
=== Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py:1.16 Mon Mar 8 07:05:59 2004
+++ Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservice.py Tue Mar 23 17:08:10 2004
@@ -197,15 +197,6 @@
menu = r.getMenu('test_id', TestObject(), TestRequest())
self.assertEqual(list(menu), [])
- def testUsage(self):
- ps = zapi.getService(None, zapi.servicenames.Presentation)
- ps.defineUsage(u'objectview')
- r = self.__reg()
- r.menu('test_id', 'test menu', usage=u'objectview')
- self.assertEqual(r.getMenuUsage('test_id'), u'objectview')
- r.menu('test_id2', 'test menu')
- self.assertEqual(r.getMenuUsage('test_id2'), u'')
-
def test_getAllMenuItema(self):
r = self.__reg()
r.menu('test_id', 'test menu')
=== Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py:1.11 Sun Dec 7 05:04:53 2003
+++ Zope3/src/zope/app/publisher/browser/tests/test_globalbrowsermenuservicedirectives.py Tue Mar 23 17:08:10 2004
@@ -11,9 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""XXX short summary goes here.
-
-XXX longer description goes here.
+"""Browser Menu Directives Tests
$Id$
"""
@@ -105,20 +103,6 @@
'test_id', TestObject(), TestRequest())
self.assertEqual(first, d(5))
-
- def testUsage(self):
-
- xmlconfig(StringIO(template % (
- """
- <browser:usage name="objectview" />
- <browser:menu id="test_id" title="test menu" usage="objectview" />
-
- <browser:menu id="test_id2" title="test menu" />
-
- """)))
-
- self.assertEqual(globalBrowserMenuService.getMenuUsage('test_id'), u'objectview')
- self.assertEqual(globalBrowserMenuService.getMenuUsage('test_id2'), u'')
def test_suite():
More information about the Zope3-Checkins
mailing list