test_base.py (825B)
1 # standard imports 2 import unittest 3 import logging 4 5 # external imports 6 from chainlib.eth.nonce import RPCNonceOracle 7 from chainlib.eth.tx import receipt 8 9 # local imports 10 from erc20_limiter import Limiter 11 from erc20_limiter.unittest import TestLimiter 12 13 logging.basicConfig(level=logging.DEBUG) 14 logg = logging.getLogger() 15 16 17 class TestLimiterBase(TestLimiter): 18 19 def test_limit(self): 20 nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) 21 c = Limiter(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) 22 (tx_hash, o) = c.set_limit(self.address, self.accounts[0], '2c26b46b68ffc68ff99b453c1d30413413422d70', 256) 23 self.rpc.do(o) 24 o = receipt(tx_hash) 25 r = self.rpc.do(o) 26 self.assertEqual(r['status'], 1) 27 28 29 if __name__ == '__main__': 30 unittest.main()