[Zope-CVS] CVS: Packages/pypes/pypes/tests - common.py:1.5 test_extent.py:1.11 test_identity.py:1.10 test_services.py:1.7

Casey Duncan casey at zope.com
Sun Feb 29 00:44:50 EST 2004


Update of /cvs-repository/Packages/pypes/pypes/tests
In directory cvs.zope.org:/tmp/cvs-serv18246/tests

Modified Files:
	common.py test_extent.py test_identity.py test_services.py 
Log Message:
Use new connection.add() method instead of assigning to _p_jar
Add this api to the zodb test scaffold
Add test that identified objects are added to the zodb conn before commit


=== Packages/pypes/pypes/tests/common.py 1.4 => 1.5 ===
--- Packages/pypes/pypes/tests/common.py:1.4	Fri Jan 30 00:35:39 2004
+++ Packages/pypes/pypes/tests/common.py	Sun Feb 29 00:44:48 2004
@@ -40,6 +40,9 @@
         
     def register(self, obj):
         pass
+    
+    def add(self, obj):
+        obj._p_jar = self
         
 class PypesTestCase(TestCase):
     """TestCase with a test zodb connection and standard pypes services 
@@ -53,7 +56,7 @@
         pypes.initialize(self.conn)
         # Simulate that the services are committed to the database
         for service in pypes.services.all(self.conn).values():
-            service._p_jar = self.conn
+            self.conn.add(service)
         self.identity = pypes.services.identity(self.conn)
         
     def _newObj(self):


=== Packages/pypes/pypes/tests/test_extent.py 1.10 => 1.11 ===
--- Packages/pypes/pypes/tests/test_extent.py:1.10	Sun Feb 22 01:09:32 2004
+++ Packages/pypes/pypes/tests/test_extent.py	Sun Feb 29 00:44:48 2004
@@ -185,7 +185,7 @@
         from pypes.identity import IdRegisteredMessage
         ident = obj._pypes_id_ = self._nextid
         self._objs[ident] = obj
-        obj._p_jar = self._conn
+        self._conn.add(obj)
         self._nextid += 1
         services.event(self._conn).send(IdRegisteredMessage(obj, ident))
     


=== Packages/pypes/pypes/tests/test_identity.py 1.9 => 1.10 ===
--- Packages/pypes/pypes/tests/test_identity.py:1.9	Sat Feb 21 23:19:54 2004
+++ Packages/pypes/pypes/tests/test_identity.py	Sun Feb 29 00:44:48 2004
@@ -328,6 +328,17 @@
         self.failUnless(isinstance(obj, TestClass))
         self.assertEqual(obj.name, 'test')
         self.assertEqual(pypesid(obj), objid)
+    
+    def testRegisterAddsObjectToConnection(self):
+        from pypes.identity import IdentityService, pypesid
+        conn = self.db.open()
+        ids = conn.root()['t'] = IdentityService()
+        get_transaction().commit()
+        
+        obj = TestClass()
+        ids.register(obj)
+        self.failUnless(obj._p_jar is conn)
+        get_transaction().commit()        
         
     def testConcurrentRegistration(self):
         from pypes.identity import IdentityService


=== Packages/pypes/pypes/tests/test_services.py 1.6 => 1.7 ===
--- Packages/pypes/pypes/tests/test_services.py:1.6	Mon Feb  9 16:27:35 2004
+++ Packages/pypes/pypes/tests/test_services.py	Sun Feb 29 00:44:49 2004
@@ -153,7 +153,7 @@
     def testGetFromPersistentOb(self):
         from pypes import services
         ob = Persistent()
-        ob._p_jar = self.conn
+        self.conn.add(ob)
         self.failUnless(services.get(ob, 'identity') is self.identity)
     
     def testGetUnregisteredService(self):
@@ -168,7 +168,7 @@
     def testAllFromPersistentOb(self):
         from pypes import services
         ob = Persistent()
-        ob._p_jar = self.conn
+        self.conn.add(ob)
         self.failUnless(services.all(ob)['identity'] is self.identity)
     
     def testIdentity(self):




More information about the Zope-CVS mailing list