Improve tests, check negative have

This commit is contained in:
lash 2023-03-24 16:13:35 +00:00
parent a614ad2cbf
commit 7a508fa113
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 11 additions and 5 deletions

View File

@ -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):