mirror of
git://holbrook.no/eth-accounts-index
synced 2024-11-26 18:46:48 +01:00
Improve tests, check negative have
This commit is contained in:
parent
a614ad2cbf
commit
7a508fa113
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user