[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component/tests - test_interfacewidget.py:1.6
Steve Alexander
steve@cat-box.net
Mon, 6 Jan 2003 14:09:59 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/component/tests
In directory cvs.zope.org:/tmp/cvs-serv3794/src/zope/app/browser/component/tests
Modified Files:
test_interfacewidget.py
Log Message:
Improved test coverage.
Fixed bugs in haveData().
=== Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py 1.5 => 1.6 === (431/531 lines abridged)
--- Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py:1.5 Mon Jan 6 13:39:29 2003
+++ Zope3/src/zope/app/browser/component/tests/test_interfacewidget.py Mon Jan 6 14:09:57 2003
@@ -61,41 +61,65 @@
self.request = request
-class TestMultiInterfaceWidget(BaseInterfaceWidgetTest):
- def testMultiInterfaceWidgetNone(self):
+class TestInterfaceWidget(BaseInterfaceWidgetTest):
+
+ def testInterfaceWidget(self):
request = self.request
- field = InterfacesField(__name__='TestName',
- title=u'This is a test',
- basetype=None)
- widget = MultiInterfaceWidget(field, request)
-
- self.assertEqual(widget.getData(), ())
+ field = InterfaceField(__name__='TestName',
+ title=u"This is a test",
+ required=False)
+
+ widget = InterfaceWidget(field, request)
+
+ self.assertEqual(widget.getData(), None)
+ self.failIf(widget.haveData())
out = (
- 'Use refresh to enter more interfaces'
- '<br>'
+ '<input type="text" name="field.TestName.search" value="">'
+ '<select name="field.TestName">'
+ '<option value="">---select interface---</option>'
- '<input type="text" name="field.TestName.search.i0" value="">'
+ '<option value="'
+ 'zope.app.browser.component.tests.test_interfacewidget.I'
+ '">'
+ 'zope.app.browser.component.tests.test_interfacewidget.I'
+ '</option>'
- '<select name="field.TestName.i0">'
+ '<option value="'
+ 'zope.app.browser.component.tests.test_interfacewidget.I2'
+ '">'
+ 'zope.app.browser.component.tests.test_interfacewidget.I2'
+ '</option>'
- '<option value="">---select interface---</option>'
[-=- -=- -=- 431 lines omitted -=- -=- -=-]
- request.form["field.TestName"] = (
- 'zope.app.browser.component.tests.test_interfacewidget.I2'
- )
- self.assertEqual(widget.getData(), I2)
+ '<input type="text" name="field.TestName.search.i1" value="">'
- out = (
- '<input type="text" name="field.TestName.search" value="">'
- '<select name="field.TestName">'
+ '<select name="field.TestName.i1">'
'<option value="">---select interface---</option>'
'<option value="'
+ 'None'
+ '" selected>'
+ 'Anything'
+ '</option>'
+ '<option value="'
'zope.app.browser.component.tests.test_interfacewidget.I'
'">'
'zope.app.browser.component.tests.test_interfacewidget.I'
'</option>'
-
'<option value="'
'zope.app.browser.component.tests.test_interfacewidget.I2'
- '" selected>'
- 'zope.app.browser.component.tests.test_interfacewidget.I2'
- '</option>'
-
- '<option value="'
- 'zope.app.browser.component.tests.test_interfacewidget.I3'
'">'
- 'zope.app.browser.component.tests.test_interfacewidget.I3'
+ 'zope.app.browser.component.tests.test_interfacewidget.I2'
'</option>'
-
- '</select>'
- )
- self.assertEqual(widget(), out)
-
- request.form["field.TestName.search"] = 'two'
- out = (
- '<input type="text" name="field.TestName.search" value="two">'
- '<select name="field.TestName">'
- '<option value="">---select interface---</option>'
-
'<option value="'
'zope.app.browser.component.tests.test_interfacewidget.I3'
'">'