Add tests for capped, expire, writer with cic-contracts unittest
This commit is contained in:
parent
ab6d99005d
commit
8d51154564
@ -1,4 +1,4 @@
|
||||
eth_tester==0.5.0b3
|
||||
py-evm==0.3.0a20
|
||||
pytest==6.0.1
|
||||
cic-contracts~=0.3.4
|
||||
cic-contracts~=0.3.5
|
||||
|
32
python/tests/test_cic_capped.py
Normal file
32
python/tests/test_cic_capped.py
Normal file
@ -0,0 +1,32 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from chainlib.eth.tx import receipt
|
||||
from eth_capped.unittest import TestEthCappedInterface
|
||||
from eth_capped.unittest.base import TestEthCapped
|
||||
from ge_capped_token.unittest import TestCappedToken
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
|
||||
|
||||
class TestEthCappedCapped(TestEthCapped, TestCappedToken, TestEthCappedInterface):
|
||||
|
||||
def setUp(self):
|
||||
super(TestEthCappedCapped, self).setUp()
|
||||
self.set_method = self.set_max_supply
|
||||
self.max_supply_value = self.initial_supply + 1
|
||||
self.publish()
|
||||
(tx_hash, o) = self.set_method(self.address, self.accounts[0], self.max_supply_value)
|
||||
self.rpc.do(o)
|
||||
o = receipt(tx_hash)
|
||||
r = self.rpc.do(o)
|
||||
self.assertEqual(r['status'], 1)
|
||||
self.contracts['capped'] = self.address
|
||||
self.roles['capped'] = self.accounts[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
39
python/tests/test_cic_expire.py
Normal file
39
python/tests/test_cic_expire.py
Normal file
@ -0,0 +1,39 @@
|
||||
# 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()
|
23
python/tests/test_cic_writer.py
Normal file
23
python/tests/test_cic_writer.py
Normal file
@ -0,0 +1,23 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from eth_writer.unittest import TestEthWriterInterface
|
||||
from eth_writer.unittest.base import TestEthWriter
|
||||
from ge_capped_token.unittest import TestCappedToken
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
|
||||
|
||||
class TestEthCappedWriter(TestCappedToken, TestEthWriterInterface):
|
||||
|
||||
def setUp(self):
|
||||
super(TestEthCappedWriter, self).setUp()
|
||||
self.contracts['writer'] = self.address
|
||||
self.roles['writer'] = self.accounts[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user