[Zope3-checkins] CVS: Zope3/src/zope/app/onlinehelp/tests - test_helpdirectives.py:1.3 test_onlinehelp.py:1.3
Stephan Richter
srichter@cosmos.phy.tufts.edu
Tue, 15 Jul 2003 10:20:20 -0400
Update of /cvs-repository/Zope3/src/zope/app/onlinehelp/tests
In directory cvs.zope.org:/tmp/cvs-serv27081/src/zope/app/onlinehelp/tests
Modified Files:
test_helpdirectives.py test_onlinehelp.py
Log Message:
Fixed the online help to do the right thing (finally). While the interfaces
said it all along, I still expected View classes in the 'view' attribute
of the help:register directive. I now (and should) uses the view name given
to a view.
In the process I also activated the unregister tests.
=== Zope3/src/zope/app/onlinehelp/tests/test_helpdirectives.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/onlinehelp/tests/test_helpdirectives.py:1.2 Thu May 1 15:35:25 2003
+++ Zope3/src/zope/app/onlinehelp/tests/test_helpdirectives.py Tue Jul 15 10:20:15 2003
@@ -21,8 +21,13 @@
from cStringIO import StringIO
from zope.interface import Interface
+from zope.component.adapter import provideAdapter
from zope.component.tests.placelesssetup import PlacelessSetup
from zope.configuration.xmlconfig import xmlconfig, Context, XMLConfig
+from zope.app.interfaces.traversing import \
+ ITraverser, ITraversable, IPhysicallyLocatable
+from zope.app.traversing.adapters import \
+ Traverser, DefaultTraversable, WrapperPhysicallyLocatable
import zope.app.onlinehelp
from zope.app.onlinehelp import help
@@ -38,14 +43,14 @@
class I1(Interface):
pass
-class View:
- pass
-
class DirectivesTest(PlacelessSetup, unittest.TestCase):
def setUp(self):
PlacelessSetup.setUp(self)
+ provideAdapter(None, ITraverser, Traverser)
+ provideAdapter(None, ITraversable, DefaultTraversable)
+ provideAdapter(None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
XMLConfig('meta.zcml', zope.app.onlinehelp)()
def test_register(self):
@@ -56,12 +61,12 @@
id = "help1"
title = "Help"
for = "zope.app.onlinehelp.tests.test_helpdirectives.I1"
- view = "zope.app.onlinehelp.tests.test_helpdirectives.View"
+ view = "view.html"
doc_path = "./help.txt" />
'''
)), None, Context([], zope.i18n.tests))
self.assertEqual(help.keys(), ['help1'])
- self.assertEqual(help._registry[(I1, View)][0].title, 'Help')
+ self.assertEqual(help._registry[(I1, 'view.html')][0].title, 'Help')
help._register = {}
del help['help1']
@@ -69,14 +74,14 @@
self.assertEqual(help.keys(), [])
path = os.path.join(testdir(), 'help.txt')
help.registerHelpTopic('', 'help', 'Help',
- path, 'txt', I1, View)
- # XXX: Requires CA setup
- #xmlconfig(StringIO(template % (
- # '''
- # <help:unregister path="help1" />
- # '''
- # )), None, Context([], zope.i18n.tests))
- #self.assertEqual(help.keys(), [])
+ path, 'txt', I1, 'view.html')
+
+ xmlconfig(StringIO(template % (
+ '''
+ <help:unregister path="help" />
+ '''
+ )), None, Context([], zope.i18n.tests))
+ self.assertEqual(help.keys(), [])
=== Zope3/src/zope/app/onlinehelp/tests/test_onlinehelp.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/onlinehelp/tests/test_onlinehelp.py:1.2 Tue Jun 24 05:56:10 2003
+++ Zope3/src/zope/app/onlinehelp/tests/test_onlinehelp.py Tue Jul 15 10:20:15 2003
@@ -17,43 +17,48 @@
"""
import os
from unittest import TestSuite, makeSuite
+from zope.component.adapter import provideAdapter
+from zope.component.tests.placelesssetup import PlacelessSetup
from zope.interface import Interface
from zope.interface.verify import verifyObject
from zope.app.onlinehelp import OnlineHelp
from zope.app.interfaces.onlinehelp import IOnlineHelp
-from zope.app.interfaces.traversing import IContainmentRoot
+from zope.app.interfaces.traversing import \
+ IContainmentRoot, ITraverser, ITraversable, IPhysicallyLocatable
+from zope.app.traversing.adapters import \
+ Traverser, DefaultTraversable, WrapperPhysicallyLocatable
from test_onlinehelptopic import TestOnlineHelpTopic, testdir
class I1(Interface):
pass
-class View:
- pass
-
-class TestOnlineHelp(TestOnlineHelpTopic):
+class TestOnlineHelp(PlacelessSetup, TestOnlineHelpTopic):
def setUp(self):
+ PlacelessSetup.setUp(self)
+ provideAdapter(None, ITraverser, Traverser)
+ provideAdapter(None, ITraversable, DefaultTraversable)
+ provideAdapter(None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
path = os.path.join(testdir(), 'help.txt')
self.topic = OnlineHelp('Help', path, 'txt')
def test_registerHelpTopic(self):
path = os.path.join(testdir(), 'help2.txt')
self.topic.registerHelpTopic('', 'help2', 'Help 2',
- path, 'txt', I1, View)
+ path, 'txt', I1, 'view.html')
self.assertEqual(self.topic['help2'].title, 'Help 2')
- self.assertEqual(self.topic._registry[(I1, View)][0].title, 'Help 2')
-
- # XXX: Needs CA setup
- #self.topic.unregisterHelpTopic('help2')
- #self.assertEqual(self.topic.get('help2', None), None)
- #self.assertEqual(self.topic._registry[(I1, View)], [])
+ self.assertEqual(self.topic._registry[(I1, 'view.html')][0].title,
+ 'Help 2')
+ self.topic.unregisterHelpTopic('help2')
+ self.assertEqual(self.topic.get('help2', None), None)
+ self.assertEqual(self.topic._registry[(I1, 'view.html')], [])
def test_getTopicsForInterfaceAndView(self):
path = os.path.join(testdir(), 'help2.txt')
self.topic.registerHelpTopic('', 'help2', 'Help 2',
- path, 'txt', I1, View)
+ path, 'txt', I1, 'view.html')
self.assertEqual(
- self.topic.getTopicsForInterfaceAndView(I1, View)[0].title,
+ self.topic.getTopicsForInterfaceAndView(I1, 'view.html')[0].title,
'Help 2')
def test_interface(self):