[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component/tests - test_interfacewidget.py:1.9
Steve Alexander
steve@cat-box.net
Wed, 8 Jan 2003 13:56:18 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/component/tests
In directory cvs.zope.org:/tmp/cvs-serv26036/src/zope/app/browser/component/tests
Modified Files:
test_interfacewidget.py
Log Message:
Wrote another test. Removed another XXX. Fixed a bug along the way too.
So, these tests really are worth writing ;-)
=== Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py:1.8 Wed Jan 8 13:42:24 2003
+++ Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py Wed Jan 8 13:56:15 2003
@@ -184,7 +184,6 @@
self.assertEqual(widget(), out)
def testInterfaceWidgetNone(self):
-
request = self.request
field = InterfaceField(__name__='TestName',
title=u"This is a test",
@@ -277,12 +276,32 @@
widget = InterfaceWidget(field, request)
- request.form["field.TestName"] = (
- 'bad interface name'
- )
+ request.form["field.TestName"] = ('bad interface name')
self.assertRaises(ConversionError, widget.getData)
+ def testHidden(self):
+ request = self.request
+ field = InterfaceField(__name__='TestName',
+ title=u"This is a test",
+ required=False)
+ widget = InterfaceWidget(field, request)
+
+ out = (
+ '<input type="hidden" name="field.TestName" value="None" />'
+ )
+ self.assertEqual(widget.hidden(), out)
+
+ request.form["field.TestName"] = (
+ 'zope.app.browser.component.tests.test_interfacewidget.I2'
+ )
+ self.assertEqual(widget.getData(), I2)
+ out = (
+ '<input type="hidden" name="field.TestName"'
+ ' value="zope.app.browser.component.tests.test_interfacewidget.I2" />'
+ )
+ self.assertEqual(widget.hidden(), out)
+
class TestMultiInterfaceWidget(BaseInterfaceWidgetTest):
def testMultiInterfaceWidget(self):
@@ -612,9 +631,7 @@
widget = MultiInterfaceWidget(field, request)
- request.form["field.TestName.i0"] = (
- 'bad interface name'
- )
+ request.form["field.TestName.i0"] = ('bad interface name')
self.assertRaises(ConversionError, widget.getData)