[CMF-checkins] SVN: CMF/trunk/CMFCalendar/browser/ - added basic
testbrowser tests for event views using the new functional setup
Yvo Schubbe
y.2006_ at wcm-solutions.de
Tue Nov 7 08:54:30 EST 2006
Log message for revision 71093:
- added basic testbrowser tests for event views using the new functional setup
Changed:
A CMF/trunk/CMFCalendar/browser/event.txt
A CMF/trunk/CMFCalendar/browser/tests.py
-=-
Added: CMF/trunk/CMFCalendar/browser/event.txt
===================================================================
--- CMF/trunk/CMFCalendar/browser/event.txt 2006-11-07 13:41:23 UTC (rev 71092)
+++ CMF/trunk/CMFCalendar/browser/event.txt 2006-11-07 13:54:29 UTC (rev 71093)
@@ -0,0 +1,40 @@
+Event Views
+-----------
+
+Set up Event and user.
+
+ >>> from Products.CMFCalendar.Event import Event
+ >>> id = app.site._setObject('myEvent', Event('myEvent'))
+
+ >>> uf = app.site.acl_users
+ >>> uf._doAddUser('mgr', 'mgrpw', ['Manager'], [])
+
+Create the browser object we'll be using.
+
+ >>> from Products.Five.testbrowser import Browser
+ >>> browser = Browser()
+ >>> browser.handleErrors = False
+ >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+
+Use the edit form with invalid input.
+
+ >>> browser.open('http://localhost/site/myEvent/@@edit.html')
+ >>> browser.getControl('[[cmf_calendar][From]]').value = 'a'
+ >>> browser.getControl('[[cmf_default][Change]]').click()
+ >>> '[[zope][There were errors]]' in browser.contents
+ True
+ >>> '[[zope][Invalid datetime data]]' in browser.contents
+ True
+
+Use the edit form with valid input.
+
+ >>> browser.getControl('[[cmf_calendar][From]]').value = '2006 11 6 12:00:00 '
+ >>> browser.getControl('[[cmf_default][Change]]').click()
+ >>> '[[zope][There were errors]]' in browser.contents
+ False
+
+Look at the result:
+
+ >>> browser.open('http://localhost/site/myEvent/@@view.html')
+ >>> '2006 11 6 12:00:00 ' in browser.contents
+ True
Property changes on: CMF/trunk/CMFCalendar/browser/event.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: CMF/trunk/CMFCalendar/browser/tests.py
===================================================================
--- CMF/trunk/CMFCalendar/browser/tests.py 2006-11-07 13:41:23 UTC (rev 71092)
+++ CMF/trunk/CMFCalendar/browser/tests.py 2006-11-07 13:54:29 UTC (rev 71093)
@@ -0,0 +1,33 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" Unit tests for browser module.
+
+$Id$
+"""
+
+import unittest
+from Testing import ZopeTestCase
+
+from Products.CMFCalendar.testing import FunctionalLayer
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ s = ZopeTestCase.FunctionalDocFileSuite('event.txt')
+ s.layer = FunctionalLayer
+ suite.addTest(s)
+ return suite
+
+if __name__ == '__main__':
+ from Products.CMFCore.testing import run
+ run(test_suite())
Property changes on: CMF/trunk/CMFCalendar/browser/tests.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
More information about the CMF-checkins
mailing list