[Checkins] SVN: Sandbox/darrylcousins/mars.formdemo/s Fixed up tests following z3c.formdemo upgrade

Darryl Cousins darryl at darrylcousins.net.nz
Sat Jul 21 02:51:12 EDT 2007


Log message for revision 78248:
  Fixed up tests following z3c.formdemo upgrade

Changed:
  U   Sandbox/darrylcousins/mars.formdemo/setup.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/addressbook/addressbook.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/application.zcml
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/layer.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/README.txt
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.txt
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.txt
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/spreadsheet/spreadsheet.txt
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.txt
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/tests.py
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/wizard/wizard.py

-=-
Modified: Sandbox/darrylcousins/mars.formdemo/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/setup.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/setup.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -27,24 +27,9 @@
     license='ZPL',
     dependency_links = ['http://download.zope.org/distribution'],
     extras_require = dict(
-        app = ['zope.app.appsetup',
-               'zope.app.authentication',
-               'zope.app.component',
-               'zope.app.container',
-               'zope.app.error',
-               'zope.app.form',
-               'zope.app.publisher',
-               'zope.app.publication',
-               'zope.app.security',
-               'zope.app.securitypolicy',
-               'zope.app.twisted',
-               'zope.app.wsgi',
-               'zope.contentprovider',
-               'zope.app.intid',
-                'z3c.formdemo',
+        app = ['z3c.formdemo',
                ],
         test = ['z3c.etestbrowser',
-                'zope.app.zcmlfiles',
                 'zope.app.testing'],
         ),
     install_requires = [
@@ -65,22 +50,7 @@
         'z3c.formdemo',
         'zc.resourcelibrary',
         'zc.table',
-        'zope.annotation',
-        'zope.contentprovider',
-        'zope.app.catalog',
-        'zope.app.folder',
-        'zope.app.container',
-        'zope.app.pagetemplate',
-        'zope.app.session',
-        'zope.component',
-        'zope.interface',
-        'zope.location',
-        'zope.pagetemplate',
-        'zope.publisher',
-        'zope.rdb',
-        'zope.schema',
-        'zope.traversing',
-        'zope.viewlet',
+        'mars.form',
         'mars.layer',
         'mars.contentprovider',
         'mars.view',

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/addressbook/addressbook.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/addressbook/addressbook.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/addressbook/addressbook.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -12,6 +12,7 @@
 
 import grok
 
+import mars.form
 import mars.view
 import mars.layer
 import mars.adapter
@@ -117,10 +118,9 @@
     grok.context(browser.EMailForm)
     grok.template('email.pt')
 
-class DateSelectWidgetTemplate(mars.template.WidgetTemplateFactory):
+class DateSelectWidgetTemplate(mars.form.WidgetTemplateFactory):
     grok.context(zope.interface.Interface)
     grok.template('dateselect.pt')
-    mars.template.widget(dateselect.DateSelectWidget)
-    mars.template.mode(INPUT_MODE)
+    mars.form.widget(dateselect.DateSelectWidget)
     mars.layer.layer(IFormLayer)
 

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/application.zcml
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/application.zcml	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/application.zcml	2007-07-21 06:51:11 UTC (rev 78248)
@@ -30,6 +30,7 @@
   <include package="mars.macro" file="meta.zcml" />
   <include package="mars.contentprovider" file="meta.zcml" />
   <include package="mars.adapter" file="meta.zcml" />
+  <include package="mars.form" file="meta.zcml" />
 
   <browser:menu id="zmi_views" title="Views" />
   <browser:menu id="zmi_actions" title="Actions" />

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/layer.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/layer.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/layer.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -1,12 +1,13 @@
 __docformat__ = "reStructuredText"
+import mars.form
 import mars.layer
 
 class IDemoBrowserLayer(mars.layer.ILayer):
     pass
 
-class IDemoDivBrowserLayer(mars.layer.IDivFormLayer, IDemoBrowserLayer):
+class IDemoDivBrowserLayer(mars.form.IDivFormLayer, IDemoBrowserLayer):
     pass
 
-class IDemoTableBrowserLayer(mars.layer.ITableFormLayer, IDemoBrowserLayer):
+class IDemoTableBrowserLayer(mars.form.ITableFormLayer, IDemoBrowserLayer):
     pass
 

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/README.txt
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/README.txt	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/README.txt	2007-07-21 06:51:11 UTC (rev 78248)
@@ -5,4 +5,4 @@
 The "Hello World Message" demo is intended to demonstrate the most minimal
 setup required to get add, edit and display to work.
 
-The original doctest is ./message.py.
+The original doctest is ./message.txt.

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -13,6 +13,7 @@
 
 import grok
 
+import mars.form
 import mars.view
 import mars.template
 import mars.layer
@@ -40,7 +41,7 @@
         self.when = when
         self.what = what
 
-class Add(mars.view.FormView, layout.AddFormLayoutSupport, form.AddForm):
+class Add(mars.form.FormView, layout.AddFormLayoutSupport, form.AddForm):
     """ A sample add form."""
     grok.name('addHelloWorld')
     grok.context(IFolder) # override the module-level context (HelloWorld)
@@ -63,7 +64,7 @@
         return absoluteURL(self.context[self._name], self.request)
 
 
-class Edit(mars.view.FormView, layout.FormLayoutSupport, form.EditForm):
+class Edit(mars.form.FormView, layout.FormLayoutSupport, form.EditForm):
     grok.name('edit')
     form.extends(form.EditForm)
     label = u'Hello World Message Edit Form'
@@ -77,7 +78,7 @@
             self.request.response.redirect(url)
 
 
-class Display(mars.view.FormView, layout.FormLayoutSupport, form.DisplayForm):
+class Display(mars.form.FormView, layout.FormLayoutSupport, form.DisplayForm):
     grok.name('index')
     fields = field.Fields(IHelloWorld)
 

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.txt
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.txt	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/message/message.txt	2007-07-21 06:51:11 UTC (rev 78248)
@@ -48,10 +48,10 @@
 Once submitted, the message is now added to the database and the display view
 is shown:
 
-  >>> testing.printElement(user, "//h1")
-  <h1>
-    A cool Hello World from Stephan on 7/1/07 !
-  </h1>
+  >>> testing.printElement(user, "//h1/span/text()",
+  ...                           multiple=True, serialize=False)
+  Stephan
+  7/1/07
 
 The message's edit form can be accessed by clicking on the "Edit Message"
 link:
@@ -83,10 +83,7 @@
 
 Of course, the view shows the latest data:
 
-  >>> testing.printElement(user, "//h1")
-  <h1>
-    A best Hello World from Roger on 7/1/07 !
-  </h1>
-
-
-
+  >>> testing.printElement(user, "//h1/span/text()",
+  ...                           multiple=True, serialize=False)
+  Roger
+  7/1/07

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -22,6 +22,7 @@
 
 import grok
 
+import mars.form
 import mars.view
 import mars.template
 import mars.layer
@@ -51,7 +52,7 @@
             setattr(self, name, value)
 
 
-class QuestionnaireAddForm(mars.view.FormView, layout.AddFormLayoutSupport,
+class QuestionnaireAddForm(mars.form.FormView, layout.AddFormLayoutSupport,
                           group.GroupForm, form.AddForm):
     """Questionnaire add form"""
     grok.name('addQuestionnaire')

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.txt
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.txt	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/questionnaire/questionnaire.txt	2007-07-21 06:51:11 UTC (rev 78248)
@@ -52,36 +52,12 @@
 Once the questionnaire has been submitted, the user is returned to the results
 screen. Now the table has an entry:
 
-  >>> testing.printElement(user, "//table/tbody/tr[1]")
-  <tr class="odd"><td
-     class="sorted-on">
+  >>> testing.printElement(user, "//table/tbody/tr[1]/td/span/text()",
+  ...                      multiple=True, serialize=False )
       Stephan Richter
-    </td>
-    <td class="right">
       27
-    </td>
-    <td class="right">
-      yes
-    </td>
-    <td class="right">
-      no
-    </td>
-    <td class="right">
-      yes
-    </td>
-    <td class="right">
-      no
-    </td>
-    <td class="right">
-      yes
-    </td>
-    <td class="right">
       5
-    </td>
-    <td class="right">
       srichter
-    </td>
-  </tr>
 
 Let's now fill out another questionnaire:
 
@@ -104,7 +80,7 @@
 Now that we have two entries, we can use the table headers cells to sort
 them. By default they are sorted by name:
 
-  >>> testing.printElement(user, "//table/tbody/tr/td[1]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[1]/span/text()",
   ...                      multiple=True, serialize=False)
   Roger Ineichen
   Stephan Richter
@@ -115,7 +91,7 @@
   >>> user.getLink('Name').click()
   >>> user.getLink('Name').click()
 
-  >>> testing.printElement(user, "//table/tbody/tr/td[1]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[1]/span/text()",
   ...                      multiple=True, serialize=False)
   Stephan Richter
   Roger Ineichen
@@ -124,7 +100,7 @@
 once sorts it in ascending order:
 
   >>> user.getLink('Age').click()
-  >>> testing.printElement(user, "//table/tbody/tr/td[2]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[2]/span/text()",
   ...                      multiple=True, serialize=False)
   27
   39
@@ -132,7 +108,7 @@
 Clicking it again, reverses the order:
 
   >>> user.getLink('Age').click()
-  >>> testing.printElement(user, "//table/tbody/tr/td[2]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[2]/span/text()",
   ...                      multiple=True, serialize=False)
   39
   27

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/spreadsheet/spreadsheet.txt
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/spreadsheet/spreadsheet.txt	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/spreadsheet/spreadsheet.txt	2007-07-21 06:51:11 UTC (rev 78248)
@@ -45,19 +45,10 @@
 
 When the page returns, we see a row with the entry of Stephan Richter, ...
 
-  >>> testing.printElement(user, "//table/tbody/tr[2]")
-  <tr class="even"><td class="sorted-on">
-      Richter
-    </td>
-    <td class="">
-      Stephan
-    </td>
-    <td class="">
-      good
-    </td>
-    <td class="">
-      <input type="submit" ... value="Edit" /></td>
-  </tr>
+  >>> testing.printElement(user, "//table/tbody/tr[2]/td/span/text()",
+  ...                        multiple=True, serialize=False)
+  Richter
+  Stephan
 
 ... but also another add evaluation row. This is by design, so that the user
 can quickly record new entries. So let's add another:
@@ -92,7 +83,7 @@
 diaplay the row:
 
   >>> user.getControl('Cancel').click()
-  >>> testing.printElement(user, "//table/tbody/tr[2]/td[3]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr[2]/td[3]/span/span/text()",
   ...                      serialize=False)
   good
 
@@ -107,7 +98,7 @@
 saving the user from accessive button clicking. Of course, the data is
 properly stored.
 
-  >>> testing.printElement(user, "//table/tbody/tr[2]/td[3]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr[2]/td[3]/span/span/text()",
   ...                      serialize=False)
   average
 
@@ -115,7 +106,7 @@
 column sorting feature that comes with the table framework. By default they
 are sorted by last name:
 
-  >>> testing.printElement(user, "//table/tbody/tr/td[1]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[1]/span/text()",
   ...                      multiple=True, serialize=False)
   Ineichen
   Richter
@@ -126,7 +117,7 @@
   >>> user.getLink('Last Name').click()
   >>> user.getLink('Last Name').click()
 
-  >>> testing.printElement(user, "//table/tbody/tr/td[1]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[1]/span/text()",
   ...                      multiple=True, serialize=False)
   Richter
   Ineichen
@@ -135,7 +126,7 @@
 clicking on it once sorts it in ascending order:
 
   >>> user.getLink('First Name').click()
-  >>> testing.printElement(user, "//table/tbody/tr/td[2]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[2]/span/text()",
   ...                      multiple=True, serialize=False)
   Roger
   Stephan
@@ -143,7 +134,7 @@
 Clicking it again, reverses the order:
 
   >>> user.getLink('First Name').click()
-  >>> testing.printElement(user, "//table/tbody/tr/td[2]/text()",
+  >>> testing.printElement(user, "//table/tbody/tr/td[2]/span/text()",
   ...                      multiple=True, serialize=False)
   Stephan
   Roger

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -21,6 +21,7 @@
                                               
 import grok
 
+import mars.form
 import mars.adapter
 import mars.resource
 import mars.viewlet
@@ -56,7 +57,7 @@
     mars.viewlet.view(ISQLMessagePage)
     mars.viewlet.manager(skin.CSSManager)
 
-class AddForm(mars.view.FormView, layout.AddFormLayoutSupport, form.AddForm):
+class AddForm(mars.form.FormView, layout.AddFormLayoutSupport, form.AddForm):
     grok.context(zope.interface.Interface)
     grok.name('addsql')
     zope.interface.implements(ISQLMessagePage)
@@ -76,7 +77,7 @@
         url = absoluteURL(self.context, self.request)
         return url + '/showallsql'
 
-class EditForm(mars.view.FormView, layout.FormLayoutSupport, form.EditForm):
+class EditForm(mars.form.FormView, layout.FormLayoutSupport, form.EditForm):
     grok.context(zope.interface.Interface)
     grok.name('editsql')
     zope.interface.implements(ISQLMessagePage)
@@ -111,7 +112,7 @@
             url += '/showsql?id=' + self.request['id']
             self.request.response.redirect(url)
 
-class DisplayForm(mars.view.FormView, layout.FormLayoutSupport, form.DisplayForm):
+class DisplayForm(mars.form.FormView, layout.FormLayoutSupport, form.DisplayForm):
     grok.context(zope.interface.Interface)
     grok.name('showsql')
     zope.interface.implements(ISQLMessagePage)

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.txt
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.txt	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/sqlmessage/sqlmessage.txt	2007-07-21 06:51:11 UTC (rev 78248)
@@ -99,10 +99,10 @@
 Clicking on any data item, brings us to the message display screen:
 
   >>> user.getLink('Stephan').click()
-  >>> testing.printElement(user, "//h1")
-  <h1>
-    A cool Hello World from Stephan on 7/1/07 !
-  </h1>
+  >>> testing.printElement(user, "//h1/span/text()",
+  ...                           multiple=True, serialize=False)
+  Stephan
+  7/1/07
 
 The message's edit form can be accessed by clicking on the "Edit Message"
 link:
@@ -134,10 +134,10 @@
 
 Of course, the view shows the latest data:
 
-  >>> testing.printElement(user, "//h1")
-  <h1>
-    A best Hello World from Roger on 7/1/07 !
-  </h1>
+  >>> testing.printElement(user, "//h1/span/text()",
+  ...                           multiple=True, serialize=False)
+  Roger
+  7/1/07
 
 From the display screen you can also return to the overview:
 

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/tests.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/tests.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/tests.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -1,26 +1,30 @@
 __docformat__ = "reStructuredText"
 import os
 import unittest
+from zope.testing import doctest
 from zope.app.testing import functional
 from mars.formdemo import testing
 
 def getRootFolder():
     return functional.FunctionalTestSetup().getRootFolder()
 
+optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
+
 def test_suite():
     suites = []
     for docpath in (
                     ('message', 'message.txt'),
                     ('questionnaire', 'questionnaire.txt'),
                     ('widgets', 'widgets.txt'),
+                    ('addressbook', 'addressbook.txt'),
                     ('spreadsheet', 'spreadsheet.txt'),
                     ('wizard', 'wizard.txt'),
-                    ('addressbook', 'addressbook.txt'),
                     ('sqlmessage', 'sqlmessage.txt'),
                     ):
         suite = functional.FunctionalDocFileSuite(
             os.path.join(*docpath),
             setUp=testing.setUp,
+            optionflags=optionflags,
             globs={'getRootFolder': getRootFolder})
         suite.layer = testing.FormDemoLayer
         suites.append(suite)

Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/wizard/wizard.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/wizard/wizard.py	2007-07-21 06:42:45 UTC (rev 78247)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/wizard/wizard.py	2007-07-21 06:51:11 UTC (rev 78248)
@@ -55,7 +55,7 @@
         self.request.response.redirect(
             self.request.getURL() + '?step=' + self.steps[0][0])
 
-class PersonSummary(mars.view.FormView, layout.FormLayoutSupport, form.DisplayForm):
+class PersonSummary(mars.form.FormView, layout.FormLayoutSupport, form.DisplayForm):
     grok.name('summary')
     grok.context(zope.interface.Interface)
 



More information about the Checkins mailing list