[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container/tests -
test_adding.py:1.21
Raju Sivalingam
sraju at zeomega.com
Wed Dec 17 04:07:53 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/container/tests
In directory cvs.zope.org:/tmp/cvs-serv19496
Modified Files:
test_adding.py
Log Message:
- one more test case has been added.
(if user don't enter name, pick one)
VS: ----------------------------------------------------------------------
=== Zope3/src/zope/app/browser/container/tests/test_adding.py 1.20 => 1.21 ===
--- Zope3/src/zope/app/browser/container/tests/test_adding.py:1.20 Tue Dec 16 09:53:47 2003
+++ Zope3/src/zope/app/browser/container/tests/test_adding.py Wed Dec 17 04:07:52 2003
@@ -307,21 +307,51 @@
... return "foo"
... def __setitem__(self, name, object):
... setattr(self, name, object)
+ ... self.name=name
... def __getitem__(self, key):
- ... return key
+ ... return self
>>> request = TestRequest()
>>> request.form.update({'add_input_name': 'reqname'})
>>> mycontainer = MyContainer()
>>> adding = Adding(mycontainer, request)
>>> o = object()
- >>> adding.add(o)
+ >>> add_obj = adding.add(o)
+ >>> add_obj.name
'reqname'
>>> mycontainer.reqname is o
True
>>> tearDown()
"""
+
+def test_chooseName():
+ """If user don't enter name, pick one
+
+ >>> class MyContainer:
+ ... zope.interface.implements(INameChooser, IContainer)
+ ... def chooseName(self, name, object):
+ ... return 'pickone'
+ ... def checkName(self, name, object):
+ ... pass
+ ... def __setitem__(self, name, object):
+ ... setattr(self, name, object)
+ ... self.name = name
+ ... def __getitem__(self, key):
+ ... return getattr(self, key)
+
+ >>> request = TestRequest()
+ >>> mycontainer = MyContainer()
+ >>> adding = Adding(mycontainer, request)
+ >>> o = object()
+ >>> add_obj = adding.add(o)
+ >>> mycontainer.name
+ 'pickone'
+ >>> add_obj is o
+ True
+ """
+
+
def test_SingleMenuItem_and_CustomAddView_NonICNC():
"""
More information about the Zope3-Checkins
mailing list