[Checkins] SVN: transaction/branches/sphinx/ Coverage for Transaction.{setUser, setExtendedInfo}.

Tres Seaver cvs-admin at zope.org
Tue Dec 18 05:25:04 UTC 2012


Log message for revision 128746:
  Coverage for Transaction.{setUser,setExtendedInfo}.

Changed:
  _U  transaction/branches/sphinx/
  U   transaction/branches/sphinx/transaction/tests/test__transaction.py

-=-
Modified: transaction/branches/sphinx/transaction/tests/test__transaction.py
===================================================================
--- transaction/branches/sphinx/transaction/tests/test__transaction.py	2012-12-18 05:25:03 UTC (rev 128745)
+++ transaction/branches/sphinx/transaction/tests/test__transaction.py	2012-12-18 05:25:03 UTC (rev 128746)
@@ -59,6 +59,8 @@
         self.assertTrue(isinstance(txn._synchronizers, WeakSet))
         self.assertEqual(len(txn._synchronizers), 0)
         self.assertTrue(txn._manager is None)
+        self.assertEqual(txn.user, "")
+        self.assertEqual(txn.description, "")
         self.assertTrue(txn._savepoint2index is None)
         self.assertEqual(txn._savepoint_index, 0)
         self.assertEqual(txn._resources, [])
@@ -920,7 +922,29 @@
         finally:
             txn.abort()
 
+    def test_setUser_default_path(self):
+        txn = self._makeOne()
+        txn.setUser('phreddy')
+        self.assertEqual(txn.user, '/ phreddy')
 
+    def test_setUser_explicit_path(self):
+        txn = self._makeOne()
+        txn.setUser('phreddy', '/bedrock')
+        self.assertEqual(txn.user, '/bedrock phreddy')
+
+    def test_setExtendedInfo_single(self):
+        txn = self._makeOne()
+        txn.setExtendedInfo('frob', 'qux')
+        self.assertEqual(txn._extension, {'frob': 'qux'})
+
+    def test_setExtendedInfo_multiple(self):
+        txn = self._makeOne()
+        txn.setExtendedInfo('frob', 'qux')
+        txn.setExtendedInfo('baz', 'spam')
+        txn.setExtendedInfo('frob', 'quxxxx')
+        self.assertEqual(txn._extension, {'frob': 'quxxxx', 'baz': 'spam'})
+
+
 class Test_oid_repr(unittest.TestCase):
 
     def _callFUT(self, oid):



More information about the checkins mailing list