[Zope3-checkins] CVS: Products3/z3checkins/tests - test_message.py:1.21

Gintautas Miliauskas gintas at pov.lt
Wed Feb 11 13:50:04 EST 2004


Update of /cvs-repository/Products3/z3checkins/tests
In directory cvs.zope.org:/tmp/cvs-serv20383/tests

Modified Files:
	test_message.py 
Log Message:
Finally dropped wrappers.


=== Products3/z3checkins/tests/test_message.py 1.20 => 1.21 ===
--- Products3/z3checkins/tests/test_message.py:1.20	Tue Feb 10 14:27:53 2004
+++ Products3/z3checkins/tests/test_message.py	Wed Feb 11 13:50:03 2004
@@ -15,8 +15,6 @@
 from zope.component import getService, servicenames
 from zope.interface import Interface, implements
 from zope.interface.verify import verifyObject
-from zope.context import getWrapperContext, getWrapperData
-from zope.context import Wrapper
 from zope.exceptions import DuplicationError
 
 from zopeproducts.z3checkins.interfaces import IMessage, IMessageContained, \
@@ -261,6 +259,8 @@
 
     implements(ICheckinMessage, IMessageContained)
 
+    __name__ = __parent__ = None
+
     def __init__(self, data=None, date=None, body=None, log_message='',
                        subject='', message_id="message at id"):
         self.data = data
@@ -480,12 +480,6 @@
         self.assertEquals(res[0].date, 3)
         self.assertEquals(res[1].date, 2)
         self.assertEquals(res[2].date, 1)
-        self.assertEquals(getWrapperContext(res[0]), view.context)
-        self.assertEquals(getWrapperContext(res[1]), view.context)
-        self.assertEquals(getWrapperContext(res[2]), view.context)
-        self.assertEquals(getWrapperData(res[0])['name'], 'c')
-        self.assertEquals(getWrapperData(res[1])['name'], 'a')
-        self.assertEquals(getWrapperData(res[2])['name'], 'z')
 
     def test_checkins_limited(self):
         from zopeproducts.z3checkins.message import ContainerView
@@ -497,19 +491,11 @@
         self.assertEquals(len(res), 2)
         self.assertEquals(res[0].date, 3)
         self.assertEquals(res[1].date, 2)
-        self.assertEquals(getWrapperContext(res[0]), view.context)
-        self.assertEquals(getWrapperContext(res[1]), view.context)
-        self.assertEquals(getWrapperData(res[0])['name'], 'c')
-        self.assertEquals(getWrapperData(res[1])['name'], 'a')
 
         res = view.checkins(start=1, size=3)
         self.assertEquals(len(res), 2)
         self.assertEquals(res[0].date, 2)
         self.assertEquals(res[1].date, 1)
-        self.assertEquals(getWrapperContext(res[0]), view.context)
-        self.assertEquals(getWrapperContext(res[1]), view.context)
-        self.assertEquals(getWrapperData(res[0])['name'], 'a')
-        self.assertEquals(getWrapperData(res[1])['name'], 'z')
 
     def test_checkins_bookmarks(self):
         from zopeproducts.z3checkins.message import ContainerView
@@ -1037,7 +1023,8 @@
     def test_navigation_empty_archive(self):
         from zopeproducts.z3checkins.message import CheckinMessageView
         view = CheckinMessageView()
-        view.context = Wrapper(MessageStub(), {'1': 2})
+        view.context = MessageStub()
+        view.context.__parent__ = {'1': 2}
         self.assertEquals(view.first(), None)
         self.assertEquals(view.last(), None)
         self.assertEquals(view.next(), None)
@@ -1049,23 +1036,27 @@
         m2 = MessageStub(date=2, message_id='2')
         m3 = MessageStub(date=3, message_id='3')
         m4 = MessageStub(date=4, message_id='4')
+        
         folder = {'1': 2, '3': 'abc', '4': m1, '5': m2, '6': m3, '7': m4}
         view = CheckinMessageView()
-        view.context = Wrapper(m3, folder)
+        view.context = m3
+        m3.__parent__ = folder
         self.assertEquals(view.first(), m1)
         self.assertEquals(view.last(), m4)
         self.assertEquals(view.next(), m4)
         self.assertEquals(view.previous(), m2)
 
         view = CheckinMessageView()
-        view.context = Wrapper(m1, folder)
+        view.context = m1
+        m1.__parent__ = folder
         self.assertEquals(view.first(), m1)
         self.assertEquals(view.last(), m4)
         self.assertEquals(view.next(), m2)
         self.assertEquals(view.previous(), None)
 
         view = CheckinMessageView()
-        view.context = Wrapper(m4, folder)
+        view.context = m4
+        m4.__parent__ = folder
         self.assertEquals(view.first(), m1)
         self.assertEquals(view.last(), m4)
         self.assertEquals(view.next(), None)




More information about the Zope3-Checkins mailing list