[Zope3-checkins] CVS: Zope3/src/zope/app/utilities/tests - test_field.py:1.2.2.2 test_schemautility.py:1.8.16.2

Marius Gedminas marius at pov.lt
Fri Mar 19 13:51:23 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/utilities/tests
In directory cvs.zope.org:/tmp/cvs-serv26650/src/zope/app/utilities/tests

Modified Files:
      Tag: mgedmin-events2-branch
	test_field.py test_schemautility.py 
Log Message:
Added IParticipation and replaced the lists of principals in IInteraction with
a list of participations.  Made BaseRequest an IParticipation and replaced
request.user with request.principal everywhere.



=== Zope3/src/zope/app/utilities/tests/test_field.py 1.2.2.1 => 1.2.2.2 ===
--- Zope3/src/zope/app/utilities/tests/test_field.py:1.2.2.1	Mon Mar  8 13:43:41 2004
+++ Zope3/src/zope/app/utilities/tests/test_field.py	Fri Mar 19 13:50:51 2004
@@ -18,13 +18,20 @@
 from zope.configuration import xmlconfig
 from zope.schema import Text, getFieldsInOrder
 from zope.security.checker import ProxyFactory
-from zope.security.management import system_user
-from zope.security.management import newInteraction, getInteraction
+from zope.security.management import newInteraction, system_user
 from zope.app.tests import setup
 from zope.app.utilities.wrapper import Struct
 from zope.security.checker import getChecker, _defaultChecker
 import zope.app.utilities.tests
 
+
+class ParticipationStub:
+
+    def __init__(self, principal):
+        self.principal = principal
+        self.interaction = None
+
+
 class FieldPersistence(unittest.TestCase):
 
     def test_field_change(self):
@@ -43,8 +50,7 @@
     def setUp(self):
         setup.placefulSetUp()
         self.context = xmlconfig.file("fields.zcml", zope.app.utilities.tests)
-        newInteraction(None)
-        getInteraction().add(system_user)
+        newInteraction(ParticipationStub(system_user))
 
     def test_wrapped_field_checker(self):
         f1 = Text(title=u'alpha')


=== Zope3/src/zope/app/utilities/tests/test_schemautility.py 1.8.16.1 => 1.8.16.2 ===
--- Zope3/src/zope/app/utilities/tests/test_schemautility.py:1.8.16.1	Mon Mar  8 13:43:41 2004
+++ Zope3/src/zope/app/utilities/tests/test_schemautility.py	Fri Mar 19 13:50:51 2004
@@ -28,6 +28,14 @@
 from zope.app import zapi
 import zope.app.utilities.tests
 
+
+class ParticipationStub:
+
+    def __init__(self, principal):
+        self.principal = principal
+        self.interaction = None
+
+
 class SchemaUtilityTests(TestCase):
 
     def _createSchemaUtility(self):
@@ -184,8 +192,7 @@
         context = xmlconfig.file("fields.zcml", zope.app.utilities.tests)
         s = self.s
         s.addField(u'alpha', self.alpha)
-        newInteraction(None)
-        getInteraction().add(system_user)
+        newInteraction(ParticipationStub(system_user))
         s = ProxyFactory(s, interaction=getInteraction())
         f1 = ProxyFactory(s[u'alpha'], interaction=getInteraction())
         order = f1.order




More information about the Zope3-Checkins mailing list