[z3-checkins] r23993 - in z3/zopeweb/trunk/content/documentation/z3tut/collector: etc ftests tests

baijum at codespeak.net baijum at codespeak.net
Sun Mar 5 19:55:00 CET 2006


Author: baijum
Date: Sun Mar  5 19:54:35 2006
New Revision: 23993

Added:
   z3/zopeweb/trunk/content/documentation/z3tut/collector/etc/overrides_ftesting.zcml
   z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/collector.txt
   z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/test_collector.py
   z3/zopeweb/trunk/content/documentation/z3tut/collector/tests/test_comment.py
Log:
Added functional testing to the example, also unit test for comment


Added: z3/zopeweb/trunk/content/documentation/z3tut/collector/etc/overrides_ftesting.zcml
==============================================================================
--- (empty file)
+++ z3/zopeweb/trunk/content/documentation/z3tut/collector/etc/overrides_ftesting.zcml	Sun Mar  5 19:54:35 2006
@@ -0,0 +1,16 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+  <!-- Here you can include overrides directives for-->
+  <!-- functional testing, may your products need so. -->
+
+  <!-- For example, you may want to include site or package overrides
+       on functional tests to make sure that the system will behave as
+       expected in the presence of overrides. -->
+
+  <!-- Example:
+       <includeOverrides files="package-includes/*-overrides.zcml" />
+       <includeOverrides file="overrides.zcml" />
+  -->
+       <includeOverrides file="overrides.zcml" />
+
+</configure>

Added: z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/collector.txt
==============================================================================
--- (empty file)
+++ z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/collector.txt	Sun Mar  5 19:54:35 2006
@@ -0,0 +1,108 @@
+
+Collector Initialization
+------------------------
+
+Initialize the browser and set authorization::
+
+  >>> from zope.testbrowser import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader("Authorization", "Basic mgr:mgrpw")
+
+Open collector adding form and check url::
+
+  >>> browser.open("http://localhost/+/AddCollector.html=mc")
+  >>> browser.url
+  'http://localhost/+/AddCollector.html=mc'
+  >>> description = browser.getControl(name="form.description")
+  >>> description.value = "MyCollector"
+
+Let's verify the value::
+
+  >>> description.value
+  'MyCollector'
+
+Submit the form and test url::
+
+  >>> browser.getControl(name="form.actions.add").click()
+  >>> browser.url
+  'http://localhost/@@contents.html'
+
+Go to new collector home::
+
+  >>> mclink = browser.getLink('mc')
+  >>> mclink.click()
+  >>> browser.url
+  'http://localhost/mc/@@CollectorMain.html'
+
+
+Ticket Adding
+-------------
+
+Visit ticket page::
+
+  >>> ticketlink = browser.getLink("Add Ticket")
+  >>> ticketlink.click()
+  >>> browser.url
+  'http://localhost/mc/@@+/AddTicket.html'
+
+Let's try to add a new ticket::
+
+  >>> ticketsummary = browser.getControl(name="form.summary")
+  >>> ticketsummary.value = "FirstTicket"
+  >>> ticketdescription = browser.getControl(name="form.description")
+  >>> ticketdescription.value = "First Ticket"
+
+Submit the form and test url::
+
+  >>> browser.getControl(name="form.actions.add").click()
+  >>> browser.url
+  'http://localhost/mc/@@CollectorMain.html'
+
+Verify the ticket just added is there::
+
+  >>> browser.contents
+  '...FirstTicket...'
+
+Adding a New Comment
+--------------------
+
+Let's click on the first ticket::
+
+  >>> homelink = browser.getLink("FirstTicket")
+  >>> homelink.click()
+  >>> browser.url
+  'http://localhost/mc/Ticket/@@+/AddComment.html'
+
+Verify the initial comment is there::
+
+  >>> browser.contents
+  '...FirstTicket...'
+  >>> browser.contents
+  '...First Ticket...'
+
+Try to add one additional comment::
+
+  >>> commentbody = browser.getControl(name="form.body")
+  >>> commentbody.value = "Comment One"
+
+Submit the form and test url::
+
+  >>> browser.getControl(name="form.actions.add").click()
+  >>> browser.url
+  'http://localhost/mc/@@CollectorMain.html'
+
+Let's click on the first ticket again::
+
+  >>> homelink = browser.getLink("FirstTicket")
+  >>> homelink.click()
+  >>> browser.url
+  'http://localhost/mc/Ticket/@@+/AddComment.html'
+
+Verify the initial comment is there::
+
+  >>> browser.contents
+  '...FirstTicket...'
+  >>> browser.contents
+  '...First Ticket...'
+  >>> browser.contents
+  '...Comment One...'

Added: z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/test_collector.py
==============================================================================
--- (empty file)
+++ z3/zopeweb/trunk/content/documentation/z3tut/collector/ftests/test_collector.py	Sun Mar  5 19:54:35 2006
@@ -0,0 +1,11 @@
+import unittest
+import doctest
+from zope.app.testing.functional import FunctionalDocFileSuite
+
+def test_suite():
+    flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+    collector = FunctionalDocFileSuite('collector.txt', optionflags=flags)
+    return unittest.TestSuite((collector, ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')

Added: z3/zopeweb/trunk/content/documentation/z3tut/collector/tests/test_comment.py
==============================================================================
--- (empty file)
+++ z3/zopeweb/trunk/content/documentation/z3tut/collector/tests/test_comment.py	Sun Mar  5 19:54:35 2006
@@ -0,0 +1,10 @@
+import unittest
+from zope.testing.doctestunit import DocTestSuite
+
+def test_suite():
+    return unittest.TestSuite((
+        DocTestSuite('collector.comment'),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


More information about the z3-checkins mailing list