40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
# standard imports
|
|
import unittest
|
|
import logging
|
|
|
|
# external imports
|
|
from chainlib.eth.tx import receipt
|
|
from chainlib.eth.block import block_latest
|
|
from chainlib.eth.block import block_by_number
|
|
from eth_expire.unittest import TestEthExpireInterface
|
|
from eth_expire.unittest.base import TestEthExpire
|
|
from ge_capped_token.unittest import TestCappedToken
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
logg = logging.getLogger()
|
|
|
|
|
|
class TestEthCappedExpire(TestEthExpire, TestCappedToken, TestEthExpireInterface):
|
|
|
|
def setUp(self):
|
|
super(TestEthCappedExpire, self).setUp()
|
|
self.set_method = self.set_expire
|
|
|
|
o = block_latest()
|
|
r = self.rpc.do(o)
|
|
o = block_by_number(r)
|
|
r = self.rpc.do(o)
|
|
|
|
self.expire_value = r['timestamp'] + 10000
|
|
self.publish()
|
|
(tx_hash, o) = self.set_method(self.address, self.accounts[0], self.expire_value)
|
|
self.rpc.do(o)
|
|
o = receipt(tx_hash)
|
|
r = self.rpc.do(o)
|
|
self.assertEqual(r['status'], 1)
|
|
self.contracts['expire'] = self.address
|
|
self.roles['expire'] = self.accounts[0]
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|