cic-cli/tests/eth/test_eth_sign.py

41 lines
1.1 KiB
Python
Raw Permalink Normal View History

2021-10-10 13:20:00 +02:00
# standard imports
import unittest
2021-10-10 13:48:32 +02:00
import logging
2021-10-10 13:20:00 +02:00
# external imports
from chainlib.eth.tx import unpack
from hexathon import (
strip_0x,
add_0x,
)
# local imports
from cic.ext.eth import CICEth
from cic.processor import Processor
2021-10-10 13:20:00 +02:00
# tests imports
from tests.eth.base_eth import TestCICEthBase
2021-10-10 13:48:32 +02:00
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
2021-10-10 13:20:00 +02:00
class TestCICEthSign(TestCICEthBase):
def setUp(self):
super(TestCICEthSign, self).setUp()
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs, signer=self.signer)
self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
2021-10-10 13:20:00 +02:00
def test_sign_token_index(self):
self.adapter.token_address = self.token_address
2021-10-15 12:48:14 +02:00
v = self.adapter.process_token_index(writer=self.outputs_writer)
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs[0][1]))
2021-10-10 13:20:00 +02:00
tx = unpack(tx_raw, self.chain_spec)
self.assertEqual(strip_0x(tx['data'])[:8], '4420e486')
if __name__ == '__main__':
unittest.main()