cic-cli/tests/eth/test_eth_sign.py
2021-10-11 12:23:08 +02:00

39 lines
941 B
Python

# standard imports
import unittest
import logging
# external imports
from chainlib.eth.tx import unpack
from hexathon import (
strip_0x,
add_0x,
)
# local imports
from cic.ext.eth import CICEth
# tests imports
from tests.eth.base_eth import TestCICEthBase
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
class TestCICEthSign(TestCICEthBase):
def setUp(self):
super(TestCICEthSign, self).setUp()
self.adapter = CICEth(self.core_processor, self.chain_spec, self.resources, self.proofs, signer=self.signer)
def test_sign_token_index(self):
self.adapter.token_address = self.token_address
v = self.adapter.process_token_index()
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs[0]))
tx = unpack(tx_raw, self.chain_spec)
self.assertEqual(strip_0x(tx['data'])[:8], '4420e486')
if __name__ == '__main__':
unittest.main()