[Zodb-checkins] CVS: Zope3/src/zodb/storage/tests - undo.py:1.10

Barry Warsaw barry@wooz.org
Wed, 9 Apr 2003 14:01:44 -0400


Update of /cvs-repository/Zope3/src/zodb/storage/tests
In directory cvs.zope.org:/tmp/cvs-serv14104

Modified Files:
	undo.py 
Log Message:
testUnicodeTransactionAttributes(): New test for checking that Unicode
user and descriptions with non-ASCII characters survive the roundtrip
through the storage.


=== Zope3/src/zodb/storage/tests/undo.py 1.9 => 1.10 ===
--- Zope3/src/zodb/storage/tests/undo.py:1.9	Thu Mar 20 18:01:41 2003
+++ Zope3/src/zodb/storage/tests/undo.py	Wed Apr  9 14:01:43 2003
@@ -13,6 +13,7 @@
 
 from zodb.storage.tests.minpo import MinPO
 from zodb.storage.tests.base import zodb_pickle, zodb_unpickle, snooze
+from zodb.storage.tests.base import handle_serials
 
 from persistence import Persistent
 from transaction import get_transaction
@@ -628,3 +629,24 @@
             eq(L1, L2)
 
         self.assertRaises(StopIteration, fsiter.next)
+
+    def testUnicodeTransactionAttributes(self):
+        eq = self.assertEqual
+        user = u'\xc2nne P\xebrson'
+        descrip = u'What this is about'
+        txn = Transaction(user=user, description=descrip)
+        self._storage.tpcBegin(txn)
+        oid = self._storage.newObjectId()
+        data, refs = zodb_pickle(MinPO(9))
+        r1 = self._storage.store(oid, None, data, refs, '', txn)
+        r2 = self._storage.tpcVote(txn)
+        self._storage.tpcFinish(txn)
+        revid = handle_serials(oid, r1, r2)
+        # Now use the iterator to find the transaction's user and descr
+        for txn in self._storage.iterator():
+            if txn.tid == revid:
+                eq(txn.user, user)
+                eq(txn.description, descrip)
+                break
+        else:
+            assert 0, 'transaction not found'