cic-cli/tests/eth/test_eth_token.py

57 lines
1.5 KiB
Python
Raw Normal View History

2021-10-10 15:37:26 +02:00
# standard imports
import os
import unittest
import logging
# external imports
from chainlib.eth.tx import (
TxFormat,
receipt,
)
# local imports
from cic.ext.eth import CICEth
# tests imports
from tests.eth.base_eth import TestCICEthBase
from tests.base_cic import test_data_dir
from giftable_erc20_token import GiftableToken
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class TestCICEthToken(TestCICEthBase):
def setUp(self):
super(TestCICEthToken, self).setUp()
self.resources['token']['reference'] = None
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs)
def test_token_nobackend(self):
self.adapter.prepare_token('FOoToken', 'FOO', 8, GiftableToken.bytecode())
v = self.adapter.process_token()
def test_token_sign(self):
self.adapter.signer = self.signer
self.adapter.tx_format = TxFormat.RLP_SIGNED
self.adapter.prepare_token('FOoToken', 'FOO', 8, GiftableToken.bytecode())
v = self.adapter.process_token()
def test_token_rpc(self):
self.adapter.signer = self.signer
self.adapter.rpc = self.rpc
self.adapter.tx_format = TxFormat.JSONRPC
self.adapter.prepare_token('FOoToken', 'FOO', 8, GiftableToken.bytecode())
v = self.adapter.process_token()
o = receipt(v)
r = self.rpc.do(o)
self.assertEqual(r['status'], 1)
if __name__ == '__main__':
unittest.main()