Commit 16be4f7c authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use test framework helpers.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1971 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 77ecc025
...@@ -126,8 +126,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -126,8 +126,7 @@ class MasterVerificationTests(NeoTestBase):
self.verification._uuid_dict[uuid] = True self.verification._uuid_dict[uuid] = True
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
self.assertEquals(len(self.verification._tid_set), 0) self.assertEquals(len(self.verification._tid_set), 0)
upper, lower = unpack('!LL', self.app.tm.getLastTID()) new_tid = self.getNextTID()
new_tid = pack('!LL', upper, lower + 10)
verification.answerUnfinishedTransactions(conn, [new_tid]) verification.answerUnfinishedTransactions(conn, [new_tid])
self.assertEquals(len(self.verification._tid_set), 0) self.assertEquals(len(self.verification._tid_set), 0)
# update dict # update dict
...@@ -135,14 +134,12 @@ class MasterVerificationTests(NeoTestBase): ...@@ -135,14 +134,12 @@ class MasterVerificationTests(NeoTestBase):
self.verification._uuid_dict[uuid] = False self.verification._uuid_dict[uuid] = False
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
self.assertEquals(len(self.verification._tid_set), 0) self.assertEquals(len(self.verification._tid_set), 0)
upper, lower = unpack('!LL', self.app.tm.getLastTID()) new_tid = self.getNextTID(new_tid)
new_tid = pack('!LL', upper, lower + 10)
verification.answerUnfinishedTransactions(conn, [new_tid,]) verification.answerUnfinishedTransactions(conn, [new_tid,])
self.assertTrue(self.verification._uuid_dict[uuid]) self.assertTrue(self.verification._uuid_dict[uuid])
self.assertEquals(len(self.verification._tid_set), 1) self.assertEquals(len(self.verification._tid_set), 1)
self.assertTrue(new_tid in self.verification._tid_set) self.assertTrue(new_tid in self.verification._tid_set)
def test_12_answerTransactionInformation(self): def test_12_answerTransactionInformation(self):
verification = self.verification verification = self.verification
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
...@@ -152,10 +149,8 @@ class MasterVerificationTests(NeoTestBase): ...@@ -152,10 +149,8 @@ class MasterVerificationTests(NeoTestBase):
self.verification._uuid_dict[uuid] = False self.verification._uuid_dict[uuid] = False
self.verification._oid_set = None self.verification._oid_set = None
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
upper, lower = unpack('!LL', self.app.tm.getLastTID()) new_tid = self.getNextTID()
new_tid = pack('!LL', upper, lower + 10) new_oid = self.getOID(1)
oid = unpack('!Q', self.app.loid)[0]
new_oid = pack('!Q', oid + 1)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", False, [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(self.verification._oid_set, None) self.assertEquals(self.verification._oid_set, None)
...@@ -185,10 +180,7 @@ class MasterVerificationTests(NeoTestBase): ...@@ -185,10 +180,7 @@ class MasterVerificationTests(NeoTestBase):
self.verification._uuid_dict[uuid] = False self.verification._uuid_dict[uuid] = False
self.assertTrue(self.verification._uuid_dict.has_key(uuid)) self.assertTrue(self.verification._uuid_dict.has_key(uuid))
self.assertEquals(len(self.verification._oid_set), 1) self.assertEquals(len(self.verification._oid_set), 1)
old_oid = new_oid new_oid = self.getOID(2)
oid = unpack('!Q', old_oid)[0]
new_oid = pack('!Q', oid + 1)
self.assertNotEqual(new_oid, old_oid)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", False, [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(self.verification._oid_set, None) self.assertEquals(self.verification._oid_set, None)
...@@ -217,10 +209,8 @@ class MasterVerificationTests(NeoTestBase): ...@@ -217,10 +209,8 @@ class MasterVerificationTests(NeoTestBase):
verification = self.verification verification = self.verification
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
# do nothing as asking_uuid_dict is True # do nothing as asking_uuid_dict is True
upper, lower = unpack('!LL', self.app.tm.getLastTID()) new_tid = self.getNextTID()
new_tid = pack('!LL', upper, lower + 10) new_oid = self.getOID(1)
oid = unpack('!Q', self.app.loid)[0]
new_oid = pack('!Q', oid + 1)
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_dict), 0) self.assertEquals(len(self.verification._uuid_dict), 0)
self.verification._uuid_dict[uuid] = True self.verification._uuid_dict[uuid] = True
......
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