From 8b006ae554a4250786aa586c72ba934c5d0756e5 Mon Sep 17 00:00:00 2001 From: lxf Date: Mon, 16 Jul 2018 18:34:35 +0800 Subject: [PATCH] update test fork case --- .../test-rpc-v3/TestCase/Identity/fork_did.py | 47 ++++++++++--------- test/test-rpc-v3/TestCase/MVSTestCase.py | 2 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/test/test-rpc-v3/TestCase/Identity/fork_did.py b/test/test-rpc-v3/TestCase/Identity/fork_did.py index 478425bda..c4fe6dc6f 100644 --- a/test/test-rpc-v3/TestCase/Identity/fork_did.py +++ b/test/test-rpc-v3/TestCase/Identity/fork_did.py @@ -196,8 +196,8 @@ 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() @@ -205,6 +205,8 @@ def test_5_fork_at_did(self): 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) @@ -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) @@ -272,19 +271,17 @@ 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) @@ -292,6 +289,10 @@ def test_5_fork_at_did(self): 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] diff --git a/test/test-rpc-v3/TestCase/MVSTestCase.py b/test/test-rpc-v3/TestCase/MVSTestCase.py index fdf19a508..b9ed19756 100644 --- a/test/test-rpc-v3/TestCase/MVSTestCase.py +++ b/test/test-rpc-v3/TestCase/MVSTestCase.py @@ -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):