cic-cli/tests/test_proof.py

36 lines
838 B
Python
Raw Normal View History

2021-10-11 08:57:03 +02:00
# standard imports
import os
import unittest
import logging
# local imports
from cic import Proof
from cic.attachment import Attachment
# test imports
2021-10-11 19:02:42 +02:00
from tests.base_cic import (
test_data_dir,
TestCICBase,
root_merged_hash,
2021-10-11 19:02:42 +02:00
)
2021-10-11 08:57:03 +02:00
logging.basicConfig(level=logging.DEBUG)
logg = logging.getLogger()
2021-10-11 19:02:42 +02:00
class TestProof(TestCICBase):
2021-10-11 08:57:03 +02:00
def test_proof_serialize_merge(self):
proof_path = os.path.join(test_data_dir, 'proof')
2021-10-11 19:02:42 +02:00
attach = Attachment(proof_path, writer=self.outputs_writer)
2021-10-11 08:57:03 +02:00
attach.load()
2021-10-11 19:02:42 +02:00
c = Proof(path=proof_path, attachments=attach, writer=self.outputs_writer)
c.load()
v = c.process(token_address=self.token_address, token_symbol=self.token_symbol)
2021-10-11 19:02:42 +02:00
self.assertEqual(v, root_merged_hash)
2021-10-11 08:57:03 +02:00
if __name__ == '__main__':
unittest.main()