eth-erc20

ERC20 interface and example giftable token contract
Log | Files | Refs | LICENSE

commit 3d71df49b89c0b09d566bcfb0022b6ce15fe61fc
parent 055710763e75e73b7c2dfeb1e61f5b9c35457114
Author: nolash <dev@holbrook.no>
Date:   Tue, 29 Jun 2021 14:35:26 +0200

Add allowance test

Diffstat:
Mpython/tests/test_erc20_interface.py | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/python/tests/test_erc20_interface.py b/python/tests/test_erc20_interface.py @@ -116,6 +116,11 @@ class TestToken(EthTesterCase): r = self.rpc.do(o) self.assertEqual(r['status'], 1) + o = c.allowance(self.address, self.accounts[0], self.accounts[1], sender_address=self.accounts[0]) + r = self.rpc.do(o) + allowance = c.parse_allowance(r) + self.assertEqual(allowance, 1000) + o = transaction(tx_hash) r = self.rpc.do(o) data = c.parse_approve_request(r['data']) @@ -175,7 +180,12 @@ class TestToken(EthTesterCase): o = receipt(tx_hash) r = self.rpc.do(o) self.assertEqual(r['status'], 1) - + + o = c.allowance(self.address, self.accounts[0], self.accounts[1], sender_address=self.accounts[0]) + r = self.rpc.do(o) + allowance = c.parse_allowance(r) + self.assertEqual(allowance, 0) + nonce_oracle = RPCNonceOracle(self.accounts[1], conn=self.conn) c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) (tx_hash, o) = c.transfer_from(self.address, self.accounts[1], self.accounts[0], self.accounts[2], 1)