cic-cli/tests/eth/base_eth.py

46 lines
1.2 KiB
Python
Raw Normal View History

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