Commit 240922ef authored by Grégory Wisniewski's avatar Grégory Wisniewski

Returns the connection instead of root object in makeTransaction.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1524 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b18bc173
...@@ -69,22 +69,22 @@ class ClientTests(NEOFunctionalTest): ...@@ -69,22 +69,22 @@ class ClientTests(NEOFunctionalTest):
def makeTransaction(self): def makeTransaction(self):
# create a transaction a get the root object # create a transaction a get the root object
txn = transaction.TransactionManager() txn = transaction.TransactionManager()
root = self.db.open(transaction_manager=txn).root() conn = self.db.open(transaction_manager=txn)
return (txn, root) return (txn, conn)
def testConflictResolutionTriggered(self): def testConflictResolutionTriggered(self):
""" Check that ConflictError is raised on write conflict """ """ Check that ConflictError is raised on write conflict """
# create the initial objects # create the initial objects
self.__setup() self.__setup()
t, r = self.makeTransaction() t, c = self.makeTransaction()
r['without_resolution'] = PCounter() c.root()['without_resolution'] = PCounter()
t.commit() t.commit()
# first with no conflict resolution # first with no conflict resolution
t1, r1 = self.makeTransaction() t1, c1 = self.makeTransaction()
t2, r2 = self.makeTransaction() t2, c2 = self.makeTransaction()
o1 = r1['without_resolution'] o1 = c1.root()['without_resolution']
o2 = r2['without_resolution'] o2 = c2.root()['without_resolution']
self.assertEqual(o1.value(), 0) self.assertEqual(o1.value(), 0)
self.assertEqual(o2.value(), 0) self.assertEqual(o2.value(), 0)
o1.inc() o1.inc()
...@@ -99,15 +99,15 @@ class ClientTests(NEOFunctionalTest): ...@@ -99,15 +99,15 @@ class ClientTests(NEOFunctionalTest):
""" Check that conflict resolution works """ """ Check that conflict resolution works """
# create the initial objects # create the initial objects
self.__setup() self.__setup()
t, r = self.makeTransaction() t, c = self.makeTransaction()
r['with_resolution'] = PCounterWithResolution() c.root()['with_resolution'] = PCounterWithResolution()
t.commit() t.commit()
# then with resolution # then with resolution
t1, r1 = self.makeTransaction() t1, c1 = self.makeTransaction()
t2, r2 = self.makeTransaction() t2, c2 = self.makeTransaction()
o1 = r1['with_resolution'] o1 = c1.root()['with_resolution']
o2 = r2['with_resolution'] o2 = c2.root()['with_resolution']
self.assertEqual(o1.value(), 0) self.assertEqual(o1.value(), 0)
self.assertEqual(o2.value(), 0) self.assertEqual(o2.value(), 0)
o1.inc() o1.inc()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment