[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/complexsample/tests - test_widget.py:1.7.22.2

Garrett Smith garrett at mojave-corp.com
Mon Mar 1 18:34:24 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/form/complexsample/tests
In directory cvs.zope.org:/tmp/cvs-serv28146/src/zope/app/browser/form/complexsample/tests

Modified Files:
      Tag: garrett-widgets2-branch
	test_widget.py 
Log Message:
Reverted changes to vocabulary widgets re widget lookup.


=== Zope3/src/zope/app/browser/form/complexsample/tests/test_widget.py 1.7.22.1 => 1.7.22.2 ===
--- Zope3/src/zope/app/browser/form/complexsample/tests/test_widget.py:1.7.22.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/complexsample/tests/test_widget.py	Mon Mar  1 18:33:48 2004
@@ -16,13 +16,12 @@
 
 import unittest
 
-from zope.app import zapi
 from zope.app.tests import ztapi
 from zope.app.browser.form.tests import support
 from zope.app.browser.form import vocabularywidget
 from zope.app.interfaces.form import WidgetInputError
-from zope.app.interfaces.form import IEditWidget, IDisplayWidget
 from zope.app.tests.placelesssetup import PlacelessSetup
+from zope.component import getView
 from zope.interface.declarations import \
      directlyProvides, providedBy, implements
 from zope.publisher.browser import TestRequest
@@ -129,37 +128,37 @@
     def setUp(self):
         super(TestBase, self).setUp()
         # display
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IVocabularyUniqueListField,
-            vocabularywidget.VocabularyUniqueListFieldDisplayWidget,
-            IDisplayWidget)
-        ztapi.browserViewProviding(
+            "display",
+            vocabularywidget.VocabularyUniqueListFieldDisplayWidget)
+        ztapi.browserView(
             ISampleVocabulary,
-            complexsample.SampleListDisplay,
-            vocabularywidget.IVocabularyListDisplayWidget)
+            "field-display-unique-list-widget",
+            complexsample.SampleListDisplay)
         # edit
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IVocabularyUniqueListField,
-            vocabularywidget.VocabularyUniqueListFieldEditWidget,
-            IEditWidget)
-        ztapi.browserViewProviding(
+            "edit",
+            vocabularywidget.VocabularyUniqueListFieldEditWidget)
+        ztapi.browserView(
             ISampleVocabulary,
-            complexsample.SampleUniqueListEdit,
-            vocabularywidget.IVocabularyMultiEditWidget)
+            "field-edit-unique-list-widget",
+            complexsample.SampleUniqueListEdit)
         # query support (edit only)
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IFancySampleVocabularyQuery,
-            complexsample.FancySampleUniqueListQueryView,
-            vocabularywidget.IWidgetQueryListHelper)
-        ztapi.browserViewProviding(
+            "widget-query-unique-list-helper",
+            complexsample.FancySampleUniqueListQueryView)
+        ztapi.browserView(
             ISampleVocabularyQuery,
-            complexsample.SampleUniqueListQueryView,
-            vocabularywidget.IWidgetQueryListHelper)
+            "widget-query-unique-list-helper",
+            complexsample.SampleUniqueListQueryView)
 
     def createWidget(self, **kw):
         request = TestRequest(**kw)
         request.processInputs()
-        return zapi.getViewProviding(self.bound, self.viewType, request)
+        return getView(self.bound, self.viewName, request)
 
 
 class SampleListTestBase(TestBase):
@@ -227,13 +226,13 @@
 class SampleListDisplayTests(SampleListTestBase):
 
     topElementName = 'ol'
-    viewType = IDisplayWidget
+    viewName = 'display'
 
 
 class SampleListEditTests(SampleListTestBase):
 
     topElementName = 'div'
-    viewType = IEditWidget
+    viewName = 'edit'
 
     def test_vocab_query(self):
         # trivial test to make sure the sample vocabulary is working
@@ -841,7 +840,7 @@
 
 class SampleListQueryTests(TestBase):
 
-    viewType = IEditWidget
+    viewName = "edit"
 
     def setUp(self):
         TestBase.setUp(self)
@@ -907,46 +906,46 @@
         self.bound = self.unbound.bind(object())
         # register the single-selection widgets
         # display
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IVocabularyField,
-            vocabularywidget.VocabularyFieldDisplayWidget,
-            IDisplayWidget)
-        ztapi.browserViewProviding(
+            "display",
+            vocabularywidget.VocabularyFieldDisplayWidget)
+        ztapi.browserView(
             ISampleVocabulary,
-            complexsample.SampleDisplay,
-            vocabularywidget.IVocabularyDisplayWidget)
+            "field-display-widget",
+            complexsample.SampleDisplay)
         # edit
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IVocabularyField,
-            vocabularywidget.VocabularyFieldEditWidget,
-            IEditWidget)
-        ztapi.browserViewProviding(
+            "edit",
+            vocabularywidget.VocabularyFieldEditWidget)
+        ztapi.browserView(
             ISampleVocabulary,
-            complexsample.SampleEdit,
-            vocabularywidget.IVocabularyEditWidget)
+            "field-edit-widget",
+            complexsample.SampleEdit)
         # query support (edit only) -- 
-        ztapi.browserViewProviding(
+        ztapi.browserView(
             IFancySampleVocabularyQuery,
-            complexsample.FancySampleQueryView,
-            vocabularywidget.IWidgetQueryHelper)
-        ztapi.browserViewProviding(
+            "widget-query-helper",
+            complexsample.FancySampleQueryView)
+        ztapi.browserView(
             ISampleVocabularyQuery,
-            complexsample.SampleQueryView,
-            vocabularywidget.IWidgetQueryHelper)
+            "widget-query-helper",
+            complexsample.SampleQueryView)
 
     def test_display_empty(self):
-        self.viewType = IDisplayWidget
+        self.viewName = "display"
         w = self.createWidget()
         self.verifyResult(w(), ["no value"])
 
     def test_display_with_form_data(self):
-        self.viewType = IDisplayWidget
+        self.viewName = "display"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path=/a/path"))
         self.verifyResult(w(), ["/a/path"])
 
     def test_display_with_bad_form_data(self):
-        self.viewType = IDisplayWidget
+        self.viewName = "display"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path=/invalid/path"))
         self.verifyResult(w(), [
@@ -956,7 +955,7 @@
             ])
 
     def test_edit_without_form_data(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget()
         self.assert_(not w.hasInput())
         self.verifyResult(w(), [
@@ -966,7 +965,7 @@
             ])
 
     def test_edit_with_empty_form_data(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(QUERY_STRING="field.path-marker=x")
         self.verifyResult(w(), [
             "no value",
@@ -975,7 +974,7 @@
             ])
 
     def test_edit_select_clears_query(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path-query.action-select=x"
                                             "&field.path-query.picks=/a/path"
@@ -993,7 +992,7 @@
             ])
 
     def test_edit_dismiss_clears_query(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(
             QUERY_STRING=("field.path-marker=x"
                           "&field.path=/b/path"
@@ -1013,7 +1012,7 @@
             ])
 
     def test_edit_clear_removes_value(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path.action-clear=x"
                                             "&field.path=/a/path"))
@@ -1026,7 +1025,7 @@
             ])
 
     def test_edit_with_form_data(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path=/a/path"))
         r = w()
@@ -1058,7 +1057,7 @@
             ], inorder=True)
 
     def test_edit_with_query(self):
-        self.viewType = IEditWidget
+        self.viewName = "edit"
         w = self.createWidget(QUERY_STRING=("field.path-marker=x"
                                             "&field.path=/a/path"
                                             "&field.path-query.start=0"




More information about the Zope3-Checkins mailing list