[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Forms/tests - testUtility.py:1.7
Jim Fulton
jim@zope.com
Wed, 11 Dec 2002 08:57:32 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms/tests
In directory cvs.zope.org:/tmp/cvs-serv11105/tests
Modified Files:
testUtility.py
Log Message:
Added the ability tp specify a list of names to a number of the
functions to specify names from a schema to be processed.
Also change the **keyword arguments to setUpWidgets to be a mapping
argument named 'initial'.
=== Zope3/lib/python/Zope/App/Forms/tests/testUtility.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/Forms/tests/testUtility.py:1.6 Mon Dec 9 11:09:18 2002
+++ Zope3/lib/python/Zope/App/Forms/tests/testUtility.py Wed Dec 11 08:57:32 2002
@@ -61,6 +61,9 @@
title.__implements__ = IViewFactory
+def kw(**kw):
+ return kw
+
class W(TextWidget):
def setData(self, v):
@@ -200,7 +203,7 @@
request = TestRequest()
view = BrowserView(c, request)
view.title = w = W(I['title'], request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(view.title(), u'title: ttt')
self.assertEqual(view.description(), u'description: ddd')
self.assertEqual(view.title, w)
@@ -210,7 +213,7 @@
request = TestRequest()
request.form['field.title'] = u'yyy'
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(view.title(), u'title: yyy')
def test_setupWidgets_w_initial_data_forced_and_request_data(self):
@@ -218,7 +221,8 @@
request = TestRequest()
request.form['field.title'] = u'yyy'
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd", force=1)
+ setUpWidgets(view, I, force=1,
+ initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(view.title(), u'title: ttt')
def test_setupEditWidgets_w_custom_widget(self):
@@ -293,7 +297,7 @@
request = TestRequest()
request.form['field.title'] = u'ft'
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(view.title(), u'title: ft')
self.assertEqual(view.description(), u'description: ddd')
@@ -304,7 +308,7 @@
request.form['field.title'] = u'ft'
request.form['field.description'] = u'fd'
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(getWidgetsData(view, I),
{'title': u'ft',
'description': u'fd'})
@@ -313,7 +317,7 @@
c = C()
request = TestRequest()
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.failIf(haveWidgetsData(view, I))
request.form['field.description'] = u'fd'
@@ -323,7 +327,7 @@
c = C()
request = TestRequest()
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(getWidgetsData(view, I, required=0), {})
self.assertRaises(MissingInputError, getWidgetsData, view, I)
@@ -340,7 +344,7 @@
request.form['field.title'] = u'ft'
request.form['field.description'] = u'fd'
view = BrowserView(c, request)
- setUpWidgets(view, I, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
getWidgetsDataForContent(view, I)
self.assertEqual(c.title, u'ft')
@@ -364,7 +368,7 @@
request = TestRequest()
request.form['field.title'] = u'ft'
view = BrowserView(c, request)
- setUpWidgets(view, I2, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I2, initial=kw(title=u"ttt", description=u"ddd"))
getWidgetsDataForContent(view, I2)
self.assertEqual(c.title, u'ft')
self.assertEqual(c.description, u'old description')
@@ -372,7 +376,7 @@
request = TestRequest()
c.title = u'old title'
view = BrowserView(c, request)
- setUpWidgets(view, I2, title=u"ttt", description=u"ddd")
+ setUpWidgets(view, I2, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(c.title, u'old title')
self.assertEqual(c.description, u'old description')