cic-cli/tests/eth/base_eth.py
2021-10-10 14:19:24 +02:00

46 lines
1.2 KiB
Python

# standard imports
import unittest
import logging
import random
# external imports
from chainlib.chain import ChainSpec
from chainlib.eth.unittest.ethtester import EthTesterCase
from hexathon import (
add_0x,
strip_0x,
)
from funga.eth.keystore.dict import DictKeystore
# local imports
from cic.ext.eth import CICEth
logg = logging.getLogger(__name__)
class TestCICEthBase(EthTesterCase):
def setUp(self):
super(TestCICEthBase, self).setUp()
random.seed(42)
self.token_address = add_0x(random.randbytes(20).hex())
self.token_index_address = add_0x(random.randbytes(20).hex())
addresses = self.keystore.list()
self.resources = {
'token': {
'reference': self.token_address,
'key_address': addresses[0],
},
'token_index': {
'reference': self.token_index_address,
'key_address': addresses[1],
},
'address_declarator': {
'reference': self.token_index_address,
'key_address': addresses[2],
},
}
self.proofs = []
for i in range(3):
self.proofs.append(random.randbytes(32).hex())