Add tests for capped, expire, writer with cic-contracts unittest

This commit is contained in:
lash 2023-06-08 16:08:03 +01:00
parent ab6d99005d
commit 8d51154564
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
4 changed files with 95 additions and 1 deletions

View File

@ -1,4 +1,4 @@
eth_tester==0.5.0b3 eth_tester==0.5.0b3
py-evm==0.3.0a20 py-evm==0.3.0a20
pytest==6.0.1 pytest==6.0.1
cic-contracts~=0.3.4 cic-contracts~=0.3.5

View 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()

View 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()

View 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()