[Checkins] SVN: z3c.formdemo/trunk/src/z3c/formdemo/ Improved test
coverage. Fixed a broken test.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Jul 2 14:53:39 EDT 2007
Log message for revision 77311:
Improved test coverage. Fixed a broken test.
Changed:
U z3c.formdemo/trunk/src/z3c/formdemo/addressbook/README.txt
U z3c.formdemo/trunk/src/z3c/formdemo/calculator/README.txt
U z3c.formdemo/trunk/src/z3c/formdemo/message/message.py
U z3c.formdemo/trunk/src/z3c/formdemo/questionnaire/questionnaire.py
U z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/README.txt
U z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/content.py
U z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/README.txt
U z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/browser.py
U z3c.formdemo/trunk/src/z3c/formdemo/wizard/README.txt
U z3c.formdemo/trunk/src/z3c/formdemo/wizard/content.py
-=-
Modified: z3c.formdemo/trunk/src/z3c/formdemo/addressbook/README.txt
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/addressbook/README.txt 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/addressbook/README.txt 2007-07-02 18:53:39 UTC (rev 77311)
@@ -47,6 +47,12 @@
>>> user.getControl('State').value = 'MA'
>>> user.getControl('ZIP').value = '01754'
+You cannot add the same address twice:
+
+ >>> user.getControl('Add', index=0).click()
+ >>> testing.printElement(user, "//div[@class='summary']")
+ <div class="summary">Address already provided for contact.</div>
+
When accidently adding another address, ...
>>> user.getControl(name='contact.add.addresses.widgets.addressName:list')\
Modified: z3c.formdemo/trunk/src/z3c/formdemo/calculator/README.txt
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/calculator/README.txt 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/calculator/README.txt 2007-07-02 18:53:39 UTC (rev 77311)
@@ -66,3 +66,17 @@
... user, "//div[@id='current']/span[@class='value']/text()",
... serialize=False)
0
+
+If a non-valid number is entered, it is just replaced by zero:
+
+ >>> user.getControl('4').click()
+ >>> user.getControl('.').click()
+ >>> user.getControl('.').click()
+ >>> user.getControl('3').click()
+
+ >>> user.getControl('=').click()
+
+ >>> testing.printElement(
+ ... user, "//div[@id='current']/span[@class='value']/text()",
+ ... serialize=False)
+ 0
Modified: z3c.formdemo/trunk/src/z3c/formdemo/message/message.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/message/message.py 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/message/message.py 2007-07-02 18:53:39 UTC (rev 77311)
@@ -33,6 +33,3 @@
self.who = who
self.when = when
self.what = what
-
- def __repr__(self):
- return '<%s from %r>' %(self.__class__.__name__, self.who)
Modified: z3c.formdemo/trunk/src/z3c/formdemo/questionnaire/questionnaire.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/questionnaire/questionnaire.py 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/questionnaire/questionnaire.py 2007-07-02 18:53:39 UTC (rev 77311)
@@ -38,6 +38,3 @@
def __init__(self, **kw):
for name, value in kw.items():
setattr(self, name, value)
-
- def __repr__(self):
- return '<%s from %r>' %(self.__class__.__name__, self.name)
Modified: z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/README.txt
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/README.txt 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/README.txt 2007-07-02 18:53:39 UTC (rev 77311)
@@ -23,7 +23,7 @@
evaluations table:
>>> testing.printElement(user, "//h1")
- <h1>Spreadsheet Demo â Candidate Evaluations</h1>
+ <h1>Spreadsheet Demo ...</h1>
Initially there are no evaluations, so the screen contains little
information. Let's first fill out a few evaluations by clicking on the button
Modified: z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/content.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/content.py 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/spreadsheet/content.py 2007-07-02 18:53:39 UTC (rev 77311)
@@ -56,7 +56,3 @@
self.lastName = lastName
self.firstName = firstName
self.rating = rating
-
- def __repr__(self):
- return '<%s %s %s>' %(
- self.__class__.__name__, self.firstName, self.lastName)
Modified: z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/README.txt
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/README.txt 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/README.txt 2007-07-02 18:53:39 UTC (rev 77311)
@@ -90,7 +90,7 @@
<a href="showSQLHelloWorld.html?id=0">cool</a>
</td>
<td class="">
- <a href="?delete=0">[Delete]</a>
+ <a href="showAllSQLHelloWorld.html?delete=0">[Delete]</a>
</td>
</tr>
@@ -183,7 +183,7 @@
To delete a contact, you Simply click on the "Delete" link of the
corresponding row:
- >>> user.getLink('[Delete]').click()
+ >>> user.getLink('[Delete]', index=1).click()
The message is now gone from the table:
Modified: z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/browser.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/browser.py 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/sqlmessage/browser.py 2007-07-02 18:53:39 UTC (rev 77311)
@@ -128,7 +128,8 @@
class DeleteSQLColumn(column.Column):
def renderCell(self, item, formatter):
- return '<a href="?delete=%i">[Delete]</a>' %item.ID
+ link = '<a href="showAllSQLHelloWorld.html?delete=%i">[Delete]</a>'
+ return link % item.ID
class HelloWorldOverview(browser.BrowserPagelet):
Modified: z3c.formdemo/trunk/src/z3c/formdemo/wizard/README.txt
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/wizard/README.txt 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/wizard/README.txt 2007-07-02 18:53:39 UTC (rev 77311)
@@ -62,13 +62,23 @@
So let's now fill out the form and click the next button this time.
>>> user.getControl('First Name').value = 'Stephan'
- >>> user.getControl('Last Name').value = 'Richter'
>>> user.getControl('Phone').value = '+1 555 276-3761'
>>> user.getControl('Email').value = 'stephan.richter_(at)_gmail.com'
>>> user.getControl('Next').click()
+But we forgot the last name, which means the form does nto successfully submit
+and an error message is shown. So we are still at step 1:
+
+ >>> testing.printElement(user, "//legend")
+ <legend>Personal Information</legend>
+
+Filling in the missing required field will allow the action to be successful:
+
+ >>> user.getControl('Last Name').value = 'Richter'
+ >>> user.getControl('Next').click()
+
You are now forwarded to the second step:
>>> testing.printElement(user, "//legend")
@@ -81,10 +91,19 @@
>>> user.getControl('Street').value = '110 Main Street'
>>> user.getControl('Zip').value = '01754'
- >>> user.getControl('City').value = 'Maynard'
>>> user.getControl('Previous').click()
+But forgetting a required field does not get you to the previous step.
+
+ >>> testing.printElement(user, "//legend")
+ <legend>Address</legend>
+
+Filling out all information causes the action to be successful:
+
+ >>> user.getControl('City').value = 'Maynard'
+ >>> user.getControl('Previous').click()
+
So back at step 1, we can see that all the personal information is there.
>>> user.getControl('First Name').value
Modified: z3c.formdemo/trunk/src/z3c/formdemo/wizard/content.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/wizard/content.py 2007-07-02 18:14:46 UTC (rev 77310)
+++ z3c.formdemo/trunk/src/z3c/formdemo/wizard/content.py 2007-07-02 18:53:39 UTC (rev 77311)
@@ -31,11 +31,7 @@
city = FieldProperty(interfaces.IPersonalInfo['city'])
zip = FieldProperty(interfaces.IPersonalInfo['zip'])
- def __repr__(self):
- return '<%s %s %s>' %(
- self.__class__.__name__, self.firstName, self.lastName)
-
class Employer(object):
zope.interface.implements(interfaces.IEmployerInfo)
@@ -44,10 +40,7 @@
city = FieldProperty(interfaces.IEmployerInfo['city'])
zip = FieldProperty(interfaces.IEmployerInfo['zip'])
- def __repr__(self):
- return '<%s %s>' %(self.__class__.__name__, self.name)
-
class Person(PersonalInfo):
def __init__(self):
More information about the Checkins
mailing list