mirror of
git://holbrook.no/eth-faucet
synced 2024-12-04 12:36:47 +01:00
tests: add test payable receive fn with tx data
Signed-off-by: lash <dev@holbrook.no>
This commit is contained in:
parent
621077aa0f
commit
09553ab019
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ build/
|
||||
dist/
|
||||
solidity/*.json
|
||||
solidity/*.bin
|
||||
.venv
|
@ -1,2 +1,2 @@
|
||||
chainlib-eth~=0.4.8
|
||||
erc20-faucet̃~=0.5.0
|
||||
erc20-faucet~=0.5.0
|
||||
|
@ -1,3 +1,3 @@
|
||||
eth_tester==0.5.0b3
|
||||
py-evm==0.3.0a20
|
||||
accounts_index~=0.3.0
|
||||
eth-accounts-index~=0.3.0
|
||||
|
@ -129,6 +129,28 @@ class TestFaucet(EthTesterCase):
|
||||
r = self.conn.do(o)
|
||||
self.assertEqual(int(r, 16), prebalance - cost + 1000)
|
||||
|
||||
def test_payable_with_tx_data(self):
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.conn)
|
||||
c = EthFaucet(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
|
||||
o = balance(self.accounts[0])
|
||||
r = self.conn.do(o)
|
||||
prebalance = int(r, 16)
|
||||
|
||||
gas_price = 1000000000
|
||||
contract_gas_oracle = OverrideGasOracle(limit=21055, price=gas_price, conn=self.conn)
|
||||
cg = Gas(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=contract_gas_oracle)
|
||||
(tx_hash_hex, o) = cg.create(self.accounts[0], self.address, 1000, data='0x0')
|
||||
self.conn.do(o)
|
||||
|
||||
o = receipt(tx_hash_hex)
|
||||
r = self.conn.do(o)
|
||||
cost = r['gas_used'] * gas_price
|
||||
self.assertEqual(r['status'], 0)
|
||||
|
||||
o = balance(self.accounts[0])
|
||||
r = self.conn.do(o)
|
||||
self.assertEqual(int(r, 16), prebalance - cost)
|
||||
|
||||
def test_basic_self(self):
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[2], self.conn)
|
||||
|
Loading…
Reference in New Issue
Block a user