[Zope3-checkins] SVN: Zope3/branches/baijum-test-layers/src/zope/app/form/ Added AppFormLayer to existing ftests.

Baiju M baiju.m.mail at gmail.com
Sun Jan 21 00:57:47 EST 2007


Log message for revision 72159:
  Added AppFormLayer to existing ftests.
  

Changed:
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_checkboxwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_datetimewidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_decimalwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_editview.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_filewidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_floatwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_i18n.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_intwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_objectwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_selectwidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textareawidget.py
  U   Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textwidget.py
  A   Zope3/branches/baijum-test-layers/src/zope/app/form/ftesting.zcml
  A   Zope3/branches/baijum-test-layers/src/zope/app/form/testing.py

-=-
Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_booleanradiowidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_booleanradiowidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Radio Widget Functional Tests
 
-$Id: $
+$Id$
 """
 import unittest
 import transaction
@@ -24,6 +24,7 @@
 from zope.schema import Bool
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -53,7 +54,7 @@
         # display edit view
         response = self.publish('/foo/edit.html')
         self.assertEqual(response.getStatus(), 200)
-        
+
         # bar field should be displayed as two radio buttons
         self.assert_(patternExists(
             '<input .*checked="checked".*name="field.bar".*type="radio".*'
@@ -88,7 +89,7 @@
     def test_missing_value(self):
         self.getRootFolder()['foo'] = Foo()
         transaction.commit()
-        
+
         # temporarily make bar field not required
         IFoo['bar'].required = False
 
@@ -103,7 +104,7 @@
         self.assert_(IFoo['bar'].missing_value is None)
         object = traverse(self.getRootFolder(), 'foo')
         self.assert_(object.bar is None)
-        
+
         # restore bar required state
         IFoo['bar'].required = True
 
@@ -111,7 +112,7 @@
     def test_required_validation(self):
         self.getRootFolder()['foo'] = Foo()
         transaction.commit()
-        
+
         self.assert_(IFoo['bar'].required)
 
         # submit missing value for required field bar
@@ -119,7 +120,7 @@
             'UPDATE_SUBMIT' : '',
             'field.bar-empty-marker' : '1'})
         self.assertEqual(response.getStatus(), 200)
-        
+
         # confirm error msgs
         self.assert_(missingInputErrorExists('bar', response.getBody()))
 
@@ -140,6 +141,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_checkboxwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_checkboxwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,6 +24,7 @@
 from zope.schema import Bool
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser import CheckBoxWidget
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
@@ -139,6 +140,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_datetimewidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_datetimewidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_datetimewidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -27,6 +27,7 @@
 from zope.schema import Datetime, Choice
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -222,6 +223,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_decimalwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_decimalwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_decimalwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -23,8 +23,9 @@
 import zope.security.checker
 from zope.interface import Interface, implements
 from zope.traversing.api import traverse
+from zope.schema import Decimal, Choice
 
-from zope.schema import Decimal, Choice
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -225,6 +226,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_editview.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_editview.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_editview.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -13,7 +13,7 @@
 ##############################################################################
 """Editview tests
 
-$Id: test_checkboxwidget.py 26267 2004-07-08 23:06:19Z garrett $
+$Id$
 """
 import unittest
 import transaction
@@ -24,6 +24,7 @@
 from zope.schema import TextLine
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -74,6 +75,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_filewidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_filewidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_filewidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -26,6 +26,7 @@
 from zope.schema import Field
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.textwidgets import FileWidget
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
@@ -165,6 +166,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_floatwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_floatwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_floatwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -22,8 +22,9 @@
 import zope.security.checker
 from zope.interface import Interface, implements
 from zope.traversing.api import traverse
+from zope.schema import Float, Choice
 
-from zope.schema import Float, Choice
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -214,6 +215,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_i18n.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_i18n.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_i18n.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -22,6 +22,7 @@
 from zope.schema import TextLine, Text, Int, List
 from zope.i18nmessageid import MessageFactory
 from zope.app.testing.functional import FunctionalDocFileSuite
+from zope.app.form.testing import AppFormLayer
 
 _ = MessageFactory('formtest')
 
@@ -60,9 +61,11 @@
     implements(IFieldContent)
 
 def test_suite():
+    i18n = FunctionalDocFileSuite('i18n.txt', package='zope.app.form.browser',
+                                  optionflags=doctest.ELLIPSIS)
+    i18n.layer = AppFormLayer
     return unittest.TestSuite([
-        FunctionalDocFileSuite('i18n.txt', package='zope.app.form.browser',
-                               optionflags=doctest.ELLIPSIS)
+        i18n,
         ])
 
 if __name__ == '__main__':

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_intwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_intwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_intwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,6 +24,7 @@
 from zope.schema import Int, Choice
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.testing.functional import BrowserTestCase
 from zope.app.form.browser.ftests.support import *
 
@@ -267,6 +268,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_objectwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_objectwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_objectwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,8 +24,8 @@
 from zope.app.form.browser import ObjectWidget
 from zope.app.testing.functional import BrowserTestCase
 from zope.app.form.browser.tests import support
+from zope.app.form.testing import AppFormLayer
 
-
 class ITestContact(Interface):
     name = TextLine()
     email = TextLine()
@@ -68,6 +68,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_selectwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_selectwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_selectwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,6 +24,7 @@
 from zope.schema import TextLine, Choice
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -137,6 +138,7 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textareawidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textareawidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textareawidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,6 +24,7 @@
 from zope.schema import Text
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -101,7 +102,7 @@
 
     def test_invalid_type(self):
         """Tests textarea widget's handling of invalid unicode input.
-        
+
         The text widget will succeed in converting any form input into
         unicode.
         """
@@ -222,12 +223,11 @@
         self.assert_(patternExists('line1\r\nline2', response.getBody()))
 
 
-
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 
 if __name__=='__main__':
     unittest.main(defaultTest='test_suite')
-

Modified: Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textwidget.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textwidget.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/browser/ftests/test_textwidget.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -24,6 +24,7 @@
 from zope.schema import TextLine, Choice
 from zope.traversing.api import traverse
 
+from zope.app.form.testing import AppFormLayer
 from zope.app.form.browser.ftests.support import *
 from zope.app.testing.functional import BrowserTestCase
 
@@ -104,7 +105,7 @@
 
     def test_invalid_type(self):
         """Tests text widget's handling of invalid unicode input.
-        
+
         The text widget will succeed in converting any form input into
         unicode.
         """
@@ -221,9 +222,9 @@
 
 def test_suite():
     suite = unittest.TestSuite()
+    Test.layer = AppFormLayer
     suite.addTest(unittest.makeSuite(Test))
     return suite
 
 if __name__=='__main__':
     unittest.main(defaultTest='test_suite')
-

Added: Zope3/branches/baijum-test-layers/src/zope/app/form/ftesting.zcml
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/ftesting.zcml	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/ftesting.zcml	2007-01-21 05:57:46 UTC (rev 72159)
@@ -0,0 +1,55 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   i18n_domain="zope"
+   package="zope.app.form"
+   >
+
+  <!-- This file is the equivalent of site.zcml and it is -->
+  <!-- used for functional testing setup -->
+
+
+  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app.form.browser.ftests" file="i18n.zcml" />
+
+  <include package="zope.app.securitypolicy" file="meta.zcml" />
+  <include package="zope.app.authentication" />
+  <include package="zope.app.securitypolicy" />
+
+  <securityPolicy
+    component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+
+  <role id="zope.Anonymous" title="Everybody"
+                 description="All users have this role implicitly" />
+  <role id="zope.Manager" title="Site Manager" />
+
+  <!-- Replace the following directive if you don't want public access -->
+  <grant permission="zope.View"
+                  role="zope.Anonymous" />
+
+  <grantAll role="zope.Manager" />
+
+  <include package="zope.app.securitypolicy.tests" file="functional.zcml" />
+
+  <!-- Principals -->
+
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User" />
+
+  <!-- Principal that tests generally run as -->
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw" />
+
+  <!-- Bootstrap principal used to make local grant to the principal above -->
+  <principal
+      id="zope.globalmgr"
+      title="Manager"
+      login="globalmgr"
+      password="globalmgrpw" />
+
+  <grant role="zope.Manager" principal="zope.globalmgr" />
+
+</configure>


Property changes on: Zope3/branches/baijum-test-layers/src/zope/app/form/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/branches/baijum-test-layers/src/zope/app/form/testing.py
===================================================================
--- Zope3/branches/baijum-test-layers/src/zope/app/form/testing.py	2007-01-21 05:06:38 UTC (rev 72158)
+++ Zope3/branches/baijum-test-layers/src/zope/app/form/testing.py	2007-01-21 05:57:46 UTC (rev 72159)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""zope.app.form common test related classes/functions/objects.
+
+$Id$
+"""
+
+__docformat__ = "reStructuredText"
+
+import os
+from zope.app.testing.functional import ZCMLLayer
+
+AppFormLayer = ZCMLLayer(
+    os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
+    __name__, 'AppFormLayer')
+


Property changes on: Zope3/branches/baijum-test-layers/src/zope/app/form/testing.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Zope3-Checkins mailing list