Skip to content

Commit

Permalink
update test fork case
Browse files Browse the repository at this point in the history
  • Loading branch information
lxffff1990 committed Jul 16, 2018
1 parent ddcc776 commit 8b006ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
47 changes: 24 additions & 23 deletions test/test-rpc-v3/TestCase/Identity/fork_did.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,17 @@ def test_5_fork_at_did(self):
mvs_rpc.new_address(Zac.name,Zac.password, 2)
mvs_rpc.remote_call(self.remote_ip, mvs_rpc.import_account)(rmtName, "123456", ' '.join(Zac.mnemonic),2)
receivers={}
receivers[Zac.addresslist[0]] = 10**10
receivers[Zac.addresslist[1]] = 10**10
receivers[Zac.addresslist[0]] = (9**10)
receivers[Zac.addresslist[1]] = (9**10)
Alice.sendmore_etp(receivers)
Alice.mining()

# asset
domain_symbol = ("Zacfork" + common.get_random_str()).upper()
asset_symbol = domain_symbol + ".AST"

# mit
mit_symbol = ("MIT." + common.get_random_str()).upper()

ec, message = mvs_rpc.get_info()
self.assertEqual(ec, 0, message)
Expand Down Expand Up @@ -238,19 +240,16 @@ def test_5_fork_at_did(self):

mvs_rpc.transfer_cert(Alice.name, Alice.password, "BLACKHOLE", domain_symbol, "DOMAIN")
self.assertEqual(ec, 0, message)
Alice.mining(10)
Alice.mining()

ec, message = mvs_rpc.get_info()
self.assertEqual(ec, 0, message)
fork_height = message[0]
ec, message = mvs_rpc.register_mit(Zac.name, Zac.password, did_symbol, mit_symbol, "test fork mit")
self.assertEqual(ec, code.success, message)
Alice.mining(5)

while fork_height < pre_height+15:
time.sleep(1)
ec, message = mvs_rpc.get_info()
self.assertEqual(ec, 0, message)
fork_height = message[0]
print "fork_height:"+str(fork_height)

ec, message = mvs_rpc.transfer_mit(Zac.name, Zac.password, "BLACKHOLE", mit_symbol)
self.assertEqual(ec, code.success, message)
Alice.mining(5)

finally:
# main chain
self.remote_ming(2)
Expand All @@ -272,26 +271,28 @@ def test_5_fork_at_did(self):

ec, message = mvs_rpc.remote_call(self.remote_ip, mvs_rpc.transfer_cert)(rmtName, "123456", "BLACKHOLE", domain_symbol, "DOMAIN")
self.assertEqual(ec, 0, message)
self.remote_ming(20)
self.remote_ming(1)

ec, message = mvs_rpc.remote_call(self.remote_ip, mvs_rpc.register_mit)(rmtName, "123456", did_symbol, mit_symbol)
self.assertEqual(ec, code.success, message)
self.remote_ming(1)

ec, message = mvs_rpc.remote_call(self.remote_ip,mvs_rpc.transfer_mit)(rmtName, "123456", "BLACKHOLE", mit_symbol)
self.assertEqual(ec, code.success, message)
self.remote_ming(20)

ec, message = mvs_rpc.remote_call(self.remote_ip, mvs_rpc.get_info)()
self.assertEqual(ec, 0, message)
main_height = message[0]

while main_height < pre_height+25:
time.sleep(1)
ec, message = mvs_rpc.remote_call(self.remote_ip, mvs_rpc.get_info)()
self.assertEqual(ec, 0, message)
main_height = message[0]
print "main_height:"+str(main_height)




ec, message = mvs_rpc.add_node( self.remote_ip+':5251')
self.assertEqual(ec, 0, message)

ec, message = mvs_rpc.remote_call(self.remote_ip, mvs_rpc.get_info)()
self.assertEqual(ec, 0, message)
main_height = message[0]

ec, message = mvs_rpc.get_info()
self.assertEqual(ec, 0, message)
fork_height = message[0]
Expand Down
2 changes: 1 addition & 1 deletion test/test-rpc-v3/TestCase/MVSTestCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setUp(self):
Alice.mining()

class ForkTestCase(MVSTestCaseBase):
remote_ip = "10.10.10.28"
remote_ip = "10.10.10.92"
remote_ctrl = None
@classmethod
def setUpClass(cls):
Expand Down

0 comments on commit 8b006ae

Please sign in to comment.