[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component/tests - test_interfacewidget.py:1.10
Steve Alexander
steve@cat-box.net
Thu, 9 Jan 2003 04:13:36 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/component/tests
In directory cvs.zope.org:/tmp/cvs-serv27270/src/zope/app/browser/component/tests
Modified Files:
test_interfacewidget.py
Log Message:
exchanged removing an XXX comment demanding a unit test for a real
unit test.
=== Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py:1.9 Wed Jan 8 13:56:15 2003
+++ Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py Thu Jan 9 04:13:03 2003
@@ -301,6 +301,28 @@
' value="zope.app.browser.component.tests.test_interfacewidget.I2" />'
)
self.assertEqual(widget.hidden(), out)
+
+ def testHiddenNone(self):
+ request = self.request
+ field = InterfaceField(__name__='TestName',
+ title=u"This is a test",
+ basetype=None)
+
+ widget = InterfaceWidget(field, request)
+
+ out = (
+ '<input type="hidden" name="field.TestName" value="None" />'
+ )
+ self.assertEqual(widget.hidden(), out)
+
+ request.form["field.TestName"] = (
+ 'None'
+ )
+ self.assertEqual(widget.getData(), None)
+ out = (
+ '<input type="hidden" name="field.TestName" value="None" />'
+ )
+ self.assertEqual(widget.hidden(), out)
class TestMultiInterfaceWidget(BaseInterfaceWidgetTest):
@@ -633,6 +655,57 @@
request.form["field.TestName.i0"] = ('bad interface name')
self.assertRaises(ConversionError, widget.getData)
+
+ def testHidden(self):
+ request = self.request
+ field = InterfacesField(__name__='TestName',
+ title=u"This is a test",
+ required=False)
+
+ widget = MultiInterfaceWidget(field, request)
+
+ self.assertEqual(widget.hidden(), '')
+
+ request.form["field.TestName.i0"] = (
+ 'zope.app.browser.component.tests.test_interfacewidget.I2'
+ )
+ self.assertEqual(widget.getData(), (I2,))
+ out = (
+ '<input type="hidden" name="field.TestName.i0"'
+ ' value="zope.app.browser.component.tests.test_interfacewidget.I2" />'
+ )
+ self.assertEqual(widget.hidden(), out)
+
+ request.form["field.TestName.i1"] = (
+ 'zope.app.browser.component.tests.test_interfacewidget.I3'
+ )
+ self.assertEqual(widget.getData(), (I2, I3))
+ out = (
+ '<input type="hidden" name="field.TestName.i0"'
+ ' value="zope.app.browser.component.tests.test_interfacewidget.I2" />'
+ '<input type="hidden" name="field.TestName.i1"'
+ ' value="zope.app.browser.component.tests.test_interfacewidget.I3" />'
+ )
+ self.assertEqual(widget.hidden(), out)
+
+ def testHiddenNone(self):
+ request = self.request
+ field = InterfacesField(__name__='TestName',
+ title=u"This is a test",
+ basetype=None)
+
+ widget = MultiInterfaceWidget(field, request)
+
+ self.assertEqual(widget.hidden(), '')
+
+ request.form["field.TestName.i0"] = (
+ 'None'
+ )
+ self.assertEqual(widget.getData(), (None,))
+ out = (
+ '<input type="hidden" name="field.TestName.i0" value="None" />'
+ )
+ self.assertEqual(widget.hidden(), out)
def test_suite():