[Zope3-checkins] CVS: Zope3/src/zope/app/container/browser/tests - test_adding.py:1.6

Suresh Babu Eddala sbabu at zeomega.com
Thu May 6 11:46:36 EDT 2004


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

Modified Files:
	test_adding.py 
Log Message:
The renderAddButton method is deprecated, use nameAllowed method.


=== Zope3/src/zope/app/container/browser/tests/test_adding.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/container/browser/tests/test_adding.py:1.5	Tue Apr 27 11:47:37 2004
+++ Zope3/src/zope/app/container/browser/tests/test_adding.py	Thu May  6 11:46:04 2004
@@ -317,9 +317,10 @@
     >>> tearDown()
     """
 
-def test_renderAddButton():
+
+def test_nameAllowed():
     """
-    Test for renderAddButton in adding.py 
+    Test for nameAllowed in adding.py 
     
     >>> setUp()
     >>> from zope.app.container.browser.adding import Adding
@@ -330,59 +331,28 @@
     >>> class FakeContainer:
     ...    zope.interface.implements(IContainerNamesContainer)
 
-    renderAddButton returns only 'Add' button if the class imlement
+    nameAllowed returns False if the class imlements
     IContainerNamesContainer
     
     >>> adding = Adding(FakeContainer(),TestRequest())
-    >>> adding.renderAddButton()
-    u" <input type='submit' name='UPDATE_SUBMIT' value='Add'>"
+    >>> adding.nameAllowed()
+    False
 
     Fake class without IContainerNamesContainer
     
     >>> class Fake:
     ...    pass
 
-    renderAddButton returns only 'Add' and 'inputbox' if the class
-    doest imlement IContainerNamesContainer
+    nameAllowed returns True if the class
+    doesn't imlement IContainerNamesContainer
 
     >>> adding = Adding(Fake(),TestRequest())
-    >>> adding.renderAddButton()
-    u"&nbsp;&nbsp;<input type='submit' name='UPDATE_SUBMIT' value='Add'>&nbsp;&nbsp;<b>Object Name:</b>&nbsp;<input type='text' name='add_input_name' value=''>"
-    >>> adding.contentName='myname'
-    >>> adding.renderAddButton()
-    u"&nbsp;&nbsp;<input type='submit' name='UPDATE_SUBMIT' value='Add'>&nbsp;&nbsp;<b>Object Name:</b>&nbsp;<input type='text' name='add_input_name' value='myname'>"
-    >>> adding = Adding(Fake(),TestRequest())     
-
-    To check request variable
-
-    >>> from zope.app.container.interfaces import IContainer
-    >>> from zope.app.publisher.browser import BrowserView
-
-    >>> class MyContainer:
-    ...    zope.interface.implements(INameChooser, IContainer)
-    ...    def chooseName(self, name, object):
-    ...        return "foo"
-    ...    def checkName(self, name, object):
-    ...        return "foo"
-    ...    def __setitem__(self, name, object):
-    ...        setattr(self, name, object)
-    ...        self.name=name
-    ...    def __getitem__(self, key):
-    ...        return self
-
-    >>> request = TestRequest()
-    >>> request.form.update({'add_input_name': 'reqname'})
-    >>> mycontainer = MyContainer()
-    >>> adding = Adding(mycontainer, request)
-    >>> o = object()
-    >>> add_obj = adding.add(o)
-    >>> add_obj.name
-    'reqname'
-    >>> mycontainer.reqname is o
+    >>> adding.nameAllowed()
     True
-    >>> tearDown()
 
     """
+
+
 
 def test_chooseName():
     """If user don't enter name, pick one




More information about the Zope3-Checkins mailing list