eth-accounts-index

Accounts index evm contract tooling with permissioned writes
Log | Files | Refs

commit 7a508fa11376cd6fac8f7acdccc20b16a17b8811
parent a614ad2cbfcb24b70b4645c60eebea7b1c0298ce
Author: lash <dev@holbrook.no>
Date:   Fri, 24 Mar 2023 16:13:35 +0000

Improve tests, check negative have

Diffstat:
Mpython/tests/test_app.py | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/python/tests/test_app.py b/python/tests/test_app.py @@ -54,7 +54,7 @@ class Test(EthTesterCase): (tx_hash, o) = c.constructor(self.accounts[0]) self.conn = RPCConnection.connect(self.chain_spec, 'default') r = self.conn.do(o) - logg.debug(f'deployed with hash {r}') + logg.debug(f'published with hash {r}') o = receipt(r) r = self.conn.do(o) @@ -80,19 +80,25 @@ class Test(EthTesterCase): def test_2_add(self): b = os.urandom(20) a = to_checksum_address(b.hex()) + b = os.urandom(20) + b = to_checksum_address(b.hex()) nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn) c = AccountsIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) (tx_hash, o) = c.add(self.address, self.accounts[0], a) - r = self.conn.do(o) - self.assertEqual(tx_hash, r) - + self.conn.do(o) o = receipt(tx_hash) - rcpt = self.conn.do(o) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) self.helper.mine_block() o = c.have(self.address, a, sender_address=self.accounts[0]) r = self.conn.do(o) + self.assertEqual(int(r, 16), 1) + + o = c.have(self.address, b, sender_address=self.accounts[0]) + r = self.conn.do(o) + self.assertEqual(int(r, 16), 0) def test_3_add_rlpsigned(self):