From 187a00ee2dffe1cc9287f7e1440433625bc1fa51 Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 2 Mar 2022 07:36:53 +0000 Subject: [PATCH] Test for sink set owner protect --- python/tests/test_period.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/python/tests/test_period.py b/python/tests/test_period.py index aa72da9..53c9d24 100644 --- a/python/tests/test_period.py +++ b/python/tests/test_period.py @@ -146,6 +146,21 @@ class TestPeriod(TestDemurrageDefault): balance = c.parse_balance_of(r) self.assertEqual(balance, 0) + nonce_oracle = RPCNonceOracle(self.accounts[5], self.rpc) + c = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + enc = ABIContractEncoder() + enc.method('setSinkAddress') + enc.typ(ABIContractType.ADDRESS) + enc.address(self.accounts[3]) + data = enc.get() + o = c.template(self.accounts[5], self.address, use_nonce=True) + o = c.set_code(o, data) + (tx_hash, o) = c.finalize(o, TxFormat.JSONRPC) + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 0) + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) c = TxFactory(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) enc = ABIContractEncoder() @@ -157,7 +172,6 @@ class TestPeriod(TestDemurrageDefault): o = c.set_code(o, data) (tx_hash, o) = c.finalize(o, TxFormat.JSONRPC) r = self.rpc.do(o) - o = receipt(tx_hash) r = self.rpc.do(o) self.assertEqual(r['status'], 1)