Make tests pass
This commit is contained in:
parent
bd73666922
commit
817fc40d84
@ -49,7 +49,8 @@ class Attachment(Data):
|
|||||||
writer = self.writer
|
writer = self.writer
|
||||||
|
|
||||||
for k in self.contents.keys():
|
for k in self.contents.keys():
|
||||||
f = open(self.contents[k], 'rb')
|
fp = os.path.join(self.attachment_path, self.contents[k])
|
||||||
|
f = open(fp, 'rb')
|
||||||
v = f.read()
|
v = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
logg.debug('writing attachment {}'.format(k))
|
logg.debug('writing attachment {}'.format(k))
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# standard imports
|
# standard imports
|
||||||
import logging
|
import logging
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
@ -42,7 +43,6 @@ class CICEth(Extension):
|
|||||||
super(CICEth, self).__init__(chain_spec, resources, proof, signer=signer, rpc=rpc, outputs_writer=outputs_writer)
|
super(CICEth, self).__init__(chain_spec, resources, proof, signer=signer, rpc=rpc, outputs_writer=outputs_writer)
|
||||||
self.fee_oracle = fee_oracle
|
self.fee_oracle = fee_oracle
|
||||||
self.tx_format = TxFormat.RAW_ARGS
|
self.tx_format = TxFormat.RAW_ARGS
|
||||||
self.outputs_writer = outputs_writer
|
|
||||||
if self.rpc != None:
|
if self.rpc != None:
|
||||||
self.tx_format = TxFormat.JSONRPC
|
self.tx_format = TxFormat.JSONRPC
|
||||||
elif self.signer != None:
|
elif self.signer != None:
|
||||||
@ -145,20 +145,23 @@ class CICEth(Extension):
|
|||||||
tx = c.set_code(tx, code)
|
tx = c.set_code(tx, code)
|
||||||
o = c.finalize(tx, self.tx_format)
|
o = c.finalize(tx, self.tx_format)
|
||||||
|
|
||||||
|
token_address_tx = None
|
||||||
r = None
|
r = None
|
||||||
if self.rpc != None:
|
if self.rpc != None:
|
||||||
r = self.rpc.do(o[1])
|
r = self.rpc.do(o[1])
|
||||||
|
token_address_tx = r
|
||||||
o = self.rpc.wait(r)
|
o = self.rpc.wait(r)
|
||||||
o = Tx.src_normalize(o)
|
o = Tx.src_normalize(o)
|
||||||
self.token_address = o['contract_address']
|
self.token_address = o['contract_address']
|
||||||
elif self.signer != None:
|
elif self.signer != None:
|
||||||
r = o[1]
|
r = o[1]
|
||||||
|
token_address_tx = r
|
||||||
|
|
||||||
if r == None:
|
if r == None:
|
||||||
r = code
|
r = code
|
||||||
writer.write('token', r.encode('utf-8'))
|
writer.write('token', r.encode('utf-8'))
|
||||||
writer.write('token_address', self.token_address.encode('utf-8'))
|
writer.write('token_address', self.token_address.encode('utf-8'))
|
||||||
self.add_outputs('token', r.encode('utf-8'))
|
self.add_outputs('token', r)
|
||||||
|
|
||||||
if self.token_details['supply'] > 0:
|
if self.token_details['supply'] > 0:
|
||||||
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=self.fee_oracle)
|
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle, gas_oracle=self.fee_oracle)
|
||||||
@ -167,12 +170,15 @@ class CICEth(Extension):
|
|||||||
if self.rpc != None:
|
if self.rpc != None:
|
||||||
r = self.rpc.do(o[1])
|
r = self.rpc.do(o[1])
|
||||||
self.rpc.wait(r)
|
self.rpc.wait(r)
|
||||||
|
writer.write('token_supply', r.encode('utf-8'))
|
||||||
elif self.signer != None:
|
elif self.signer != None:
|
||||||
r = o[1]
|
r = o[1]
|
||||||
|
writer.write('token_supply', json.dumps(r).encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
r = o
|
r = o
|
||||||
writer.write('token_supply', r.encode('utf-8'))
|
writer.write('token_supply', r.encode('utf-8'))
|
||||||
return r
|
|
||||||
|
return token_address_tx
|
||||||
|
|
||||||
|
|
||||||
def process_token_index(self, writer=None):
|
def process_token_index(self, writer=None):
|
||||||
|
@ -4,12 +4,15 @@ import logging
|
|||||||
# external imports
|
# external imports
|
||||||
from hexathon import valid as valid_hex
|
from hexathon import valid as valid_hex
|
||||||
|
|
||||||
|
# local imports
|
||||||
|
from cic.output import StdoutWriter
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Extension:
|
class Extension:
|
||||||
|
|
||||||
def __init__(self, chain_spec, resources, proof, signer=None, rpc=None, outputs_writer=None):
|
def __init__(self, chain_spec, resources, proof, signer=None, rpc=None, outputs_writer=StdoutWriter()):
|
||||||
self.resources = resources
|
self.resources = resources
|
||||||
self.proof = proof
|
self.proof = proof
|
||||||
self.chain_spec = chain_spec
|
self.chain_spec = chain_spec
|
||||||
@ -19,6 +22,7 @@ class Extension:
|
|||||||
self.token_address = None
|
self.token_address = None
|
||||||
self.token_code = None
|
self.token_code = None
|
||||||
self.outputs = []
|
self.outputs = []
|
||||||
|
self.outputs_writer = outputs_writer
|
||||||
|
|
||||||
|
|
||||||
# TODO: apply / prepare token can be factored out
|
# TODO: apply / prepare token can be factored out
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# standard imports
|
# standard imports
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class OutputWriter:
|
class OutputWriter:
|
||||||
@ -27,6 +30,7 @@ class KVWriter(OutputWriter):
|
|||||||
|
|
||||||
def write(self, k, v):
|
def write(self, k, v):
|
||||||
fp = os.path.join(self.path, str(k))
|
fp = os.path.join(self.path, str(k))
|
||||||
|
logg.debug('path write {} {}'.format(fp, str(v)))
|
||||||
f = open(fp, 'wb')
|
f = open(fp, 'wb')
|
||||||
f.write(v)
|
f.write(v)
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -33,14 +33,13 @@ class Processor:
|
|||||||
def process(self, writer=None):
|
def process(self, writer=None):
|
||||||
|
|
||||||
tasks = [
|
tasks = [
|
||||||
#'attachment',
|
'attachment',
|
||||||
#'proof',
|
'proof',
|
||||||
'metadata',
|
'metadata',
|
||||||
]
|
]
|
||||||
|
|
||||||
for ext in self.extensions:
|
for ext in self.extensions:
|
||||||
# token_address = ext.process()
|
token_address = ext.process()
|
||||||
token_address = '0x1222afdeadbeef'
|
|
||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
a = self.cores.get(task)
|
a = self.cores.get(task)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
funga>=0.5.0a1,<0.6.0
|
funga-eth>=0.5.0a1,<0.6.0
|
||||||
cic-types>=0.2.0a1,<=0.2.0
|
cic-types>=0.2.0a3,<=0.2.0
|
||||||
confini>=0.4.2rc3,<0.5.0
|
confini>=0.4.2rc3,<0.5.0
|
||||||
chainlib>=0.0.10a1,<0.1.0
|
chainlib>=0.0.10a1,<0.1.0
|
||||||
cbor2==4.5.1
|
cbor2==5.4.1
|
||||||
|
@ -3,3 +3,5 @@ eth_tester==0.5.0b3
|
|||||||
py-evm==0.3.0a20
|
py-evm==0.3.0a20
|
||||||
rlp==2.0.1
|
rlp==2.0.1
|
||||||
chainlib-eth>=0.0.10a2,<0.1.0
|
chainlib-eth>=0.0.10a2,<0.1.0
|
||||||
|
eth-address-index>=0.2.4a1,<0.3.0
|
||||||
|
okota>=0.2.4a6,<0.3.0
|
||||||
|
@ -22,8 +22,8 @@ test_data_dir = os.path.join(test_base_dir, 'testdata')
|
|||||||
proof_hash = '0f6fc017f29caf512c0feaaf83bc10614b488311cace2973dc248dc24b01e04f'
|
proof_hash = '0f6fc017f29caf512c0feaaf83bc10614b488311cace2973dc248dc24b01e04f'
|
||||||
foo_hash = '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
|
foo_hash = '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
|
||||||
bar_hash = 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'
|
bar_hash = 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'
|
||||||
root_merged_hash = '1b38b0e9a2cc0895c72e5f460a613bb0f3d88c4a87c1ee2b39a41c64f1dbcd1e'
|
root_merged_hash = 'ba135f8518d36af5fa65c59317ea9602c4b654d998ea9097ecf81e0638a03441'
|
||||||
root_unmerged_hash = '86d0091b98635a45da472388a1204104d7d10ea1199c1bd9c1d235de73a2c285'
|
root_unmerged_hash = '68ccfe99fd905be439b09dcd780993865598605b8492462a6fc4f127b688fef6'
|
||||||
|
|
||||||
|
|
||||||
class TestCICBase(unittest.TestCase):
|
class TestCICBase(unittest.TestCase):
|
||||||
|
@ -109,5 +109,6 @@ class TestCICEthTokenBase(TestCICEthBase):
|
|||||||
self.token_name = 'FOotoken'
|
self.token_name = 'FOotoken'
|
||||||
self.token_symbol = 'FOO'
|
self.token_symbol = 'FOO'
|
||||||
self.token_precision = 8
|
self.token_precision = 8
|
||||||
|
self.token_supply = 1073741824
|
||||||
|
|
||||||
self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
||||||
|
@ -34,6 +34,7 @@ from tests.eth.base_eth import TestCICEthTokenBase
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
logg.setLevel(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class TestCICEthRPC(TestCICEthTokenBase):
|
class TestCICEthRPC(TestCICEthTokenBase):
|
||||||
@ -43,7 +44,7 @@ class TestCICEthRPC(TestCICEthTokenBase):
|
|||||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||||
gas_oracle = RPCGasOracle(self.rpc)
|
gas_oracle = RPCGasOracle(self.rpc)
|
||||||
|
|
||||||
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs, signer=self.signer, rpc=self.rpc, fee_oracle=gas_oracle)
|
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs, signer=self.signer, rpc=self.rpc, fee_oracle=gas_oracle, outputs_writer=self.outputs_writer)
|
||||||
self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ class TestCICEthRPC(TestCICEthTokenBase):
|
|||||||
|
|
||||||
def test_rpc_process_withtoken(self):
|
def test_rpc_process_withtoken(self):
|
||||||
self.adapter.fee_oracle = OverrideGasOracle(limit=GiftableToken.gas(), conn=self.rpc)
|
self.adapter.fee_oracle = OverrideGasOracle(limit=GiftableToken.gas(), conn=self.rpc)
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode())
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode(), self.token_supply)
|
||||||
self.adapter.process()
|
self.adapter.process()
|
||||||
|
|
||||||
results = self.adapter.get_outputs()
|
results = self.adapter.get_outputs()
|
||||||
@ -96,7 +97,7 @@ class TestCICEthRPC(TestCICEthTokenBase):
|
|||||||
|
|
||||||
def test_rpc_process_top(self):
|
def test_rpc_process_top(self):
|
||||||
self.adapter.fee_oracle = OverrideGasOracle(limit=GiftableToken.gas(), conn=self.rpc)
|
self.adapter.fee_oracle = OverrideGasOracle(limit=GiftableToken.gas(), conn=self.rpc)
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode())
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode(), self.token_supply)
|
||||||
self.core_processor.process()
|
self.core_processor.process()
|
||||||
|
|
||||||
results = self.adapter.get_outputs()
|
results = self.adapter.get_outputs()
|
||||||
|
@ -19,13 +19,17 @@ class TestCICEthOffline(TestCICEthBase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCICEthOffline, self).setUp()
|
super(TestCICEthOffline, self).setUp()
|
||||||
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs)
|
self.adapter = CICEth(self.chain_spec, self.resources, self.proofs)
|
||||||
self.first_proof = self.proofs.get()[0]
|
proofs = []
|
||||||
|
for proof in self.proofs.get():
|
||||||
|
proofs.append(proof[0])
|
||||||
|
proofs.sort()
|
||||||
|
self.first_proof = proofs[0]
|
||||||
#self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
#self.core_processor = Processor(outputs_writer=self.outputs_writer, extensions=[self.adapter])
|
||||||
|
|
||||||
|
|
||||||
def test_offline_token_index(self):
|
def test_offline_token_index(self):
|
||||||
self.adapter.token_address = self.token_address
|
self.adapter.token_address = self.token_address
|
||||||
self.adapter.process_token_index()
|
self.adapter.process_token_index(writer=self.outputs_writer)
|
||||||
self.assertEqual(self.adapter.outputs[0][0], 'token_index')
|
self.assertEqual(self.adapter.outputs[0][0], 'token_index')
|
||||||
self.assertEqual(self.adapter.outputs[0][1][:8], '4420e486')
|
self.assertEqual(self.adapter.outputs[0][1][:8], '4420e486')
|
||||||
|
|
||||||
@ -43,6 +47,8 @@ class TestCICEthOffline(TestCICEthBase):
|
|||||||
self.adapter.outputs_writer = self.outputs_writer
|
self.adapter.outputs_writer = self.outputs_writer
|
||||||
self.adapter.token_address = self.token_address
|
self.adapter.token_address = self.token_address
|
||||||
self.adapter.process_address_declarator()
|
self.adapter.process_address_declarator()
|
||||||
|
logg.debug('proocs {}'.format(self.proofs))
|
||||||
|
logg.debug('outputs {}'.format(self.adapter.outputs))
|
||||||
self.assertEqual(self.adapter.outputs[0][0], 'address_declarator_' + self.first_proof)
|
self.assertEqual(self.adapter.outputs[0][0], 'address_declarator_' + self.first_proof)
|
||||||
self.assertEqual(self.adapter.outputs[0][1][:8], 'ae47ece0')
|
self.assertEqual(self.adapter.outputs[0][1][:8], 'ae47ece0')
|
||||||
self.assertEqual(len(self.adapter.outputs), 3)
|
self.assertEqual(len(self.adapter.outputs), 3)
|
||||||
|
@ -30,7 +30,7 @@ class TestCICEthSign(TestCICEthBase):
|
|||||||
|
|
||||||
def test_sign_token_index(self):
|
def test_sign_token_index(self):
|
||||||
self.adapter.token_address = self.token_address
|
self.adapter.token_address = self.token_address
|
||||||
v = self.adapter.process_token_index()
|
v = self.adapter.process_token_index(writer=self.outputs_writer)
|
||||||
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs[0][1]))
|
tx_raw = bytes.fromhex(strip_0x(self.adapter.outputs[0][1]))
|
||||||
tx = unpack(tx_raw, self.chain_spec)
|
tx = unpack(tx_raw, self.chain_spec)
|
||||||
self.assertEqual(strip_0x(tx['data'])[:8], '4420e486')
|
self.assertEqual(strip_0x(tx['data'])[:8], '4420e486')
|
||||||
|
@ -7,6 +7,7 @@ import logging
|
|||||||
from chainlib.eth.tx import (
|
from chainlib.eth.tx import (
|
||||||
TxFormat,
|
TxFormat,
|
||||||
receipt,
|
receipt,
|
||||||
|
Tx,
|
||||||
)
|
)
|
||||||
from chainlib.eth.contract import (
|
from chainlib.eth.contract import (
|
||||||
abi_decode_single,
|
abi_decode_single,
|
||||||
@ -27,28 +28,31 @@ from tests.base_cic import test_data_dir
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
logg.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class TestCICEthToken(TestCICEthTokenBase):
|
class TestCICEthToken(TestCICEthTokenBase):
|
||||||
|
|
||||||
def test_token_nobackend(self):
|
def test_token_nobackend(self):
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode())
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode(), 0)
|
||||||
v = self.adapter.process_token()
|
self.adapter.token_address = self.token_address
|
||||||
|
v = self.adapter.process_token(writer=self.outputs_writer)
|
||||||
|
|
||||||
|
|
||||||
def test_token_sign(self):
|
def test_token_sign(self):
|
||||||
|
self.adapter.token_address = self.token_address
|
||||||
self.adapter.signer = self.signer
|
self.adapter.signer = self.signer
|
||||||
self.adapter.tx_format = TxFormat.RLP_SIGNED
|
self.adapter.tx_format = TxFormat.RLP_SIGNED
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode())
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode(), self.token_supply)
|
||||||
v = self.adapter.process_token()
|
v = self.adapter.process_token(writer=self.outputs_writer)
|
||||||
|
|
||||||
|
|
||||||
def test_token_rpc(self):
|
def test_token_rpc(self):
|
||||||
self.adapter.signer = self.signer
|
self.adapter.signer = self.signer
|
||||||
self.adapter.rpc = self.rpc
|
self.adapter.rpc = self.rpc
|
||||||
self.adapter.tx_format = TxFormat.JSONRPC
|
self.adapter.tx_format = TxFormat.JSONRPC
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode())
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, GiftableToken.bytecode(), self.token_supply)
|
||||||
v = self.adapter.process_token()
|
v = self.adapter.process_token(writer=self.outputs_writer)
|
||||||
o = receipt(v)
|
o = receipt(v)
|
||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
self.assertEqual(r['status'], 1)
|
self.assertEqual(r['status'], 1)
|
||||||
@ -60,10 +64,11 @@ class TestCICEthToken(TestCICEthTokenBase):
|
|||||||
weird_bytecode = f.read()
|
weird_bytecode = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
try:
|
try:
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, weird_bytecode, extra=['0xdeadbeef'], extra_types=['bytes32'])
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, weird_bytecode, self.token_supply, extra=['0xdeadbeef'], extra_types=['bytes32'])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
v = self.adapter.process_token()
|
v = self.adapter.process_token(writer=self.outputs_writer)
|
||||||
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, weird_bytecode, extra=['0xdeadbeef'], extra_types=['bytes32'], positions=[1, 2, 3, 0])
|
self.adapter.prepare_token(self.token_name, self.token_symbol, self.token_precision, weird_bytecode, self.token_supply, extra=['0xdeadbeef'], extra_types=['bytes32'], positions=[1, 2, 3, 0])
|
||||||
|
self.adapter.load_code()
|
||||||
self.adapter.signer = self.signer
|
self.adapter.signer = self.signer
|
||||||
self.adapter.rpc = self.rpc
|
self.adapter.rpc = self.rpc
|
||||||
self.adapter.tx_format = TxFormat.JSONRPC
|
self.adapter.tx_format = TxFormat.JSONRPC
|
||||||
@ -72,10 +77,11 @@ class TestCICEthToken(TestCICEthTokenBase):
|
|||||||
o = receipt(v)
|
o = receipt(v)
|
||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
self.assertEqual(r['status'], 1)
|
self.assertEqual(r['status'], 1)
|
||||||
|
Tx.src_normalize(r)
|
||||||
contract_address = r['contract_address']
|
contract_address = r['contract_address']
|
||||||
|
logg.debug('contract address {}'.format(contract_address))
|
||||||
|
|
||||||
c = ERC20(self.chain_spec)
|
c = ERC20(self.chain_spec)
|
||||||
|
|
||||||
o = c.name(contract_address, sender_address=self.accounts[0])
|
o = c.name(contract_address, sender_address=self.accounts[0])
|
||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
self.assertEqual(c.parse_name(r), self.token_name)
|
self.assertEqual(c.parse_name(r), self.token_name)
|
||||||
|
@ -3,6 +3,7 @@ import unittest
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
from hexathon import strip_0x
|
from hexathon import strip_0x
|
||||||
@ -12,6 +13,7 @@ from cic import Proof
|
|||||||
from cic.processor import Processor
|
from cic.processor import Processor
|
||||||
from cic.attachment import Attachment
|
from cic.attachment import Attachment
|
||||||
from cic.meta import Meta
|
from cic.meta import Meta
|
||||||
|
from cic.output import KVWriter
|
||||||
|
|
||||||
# test imports
|
# test imports
|
||||||
from tests.base_cic import (
|
from tests.base_cic import (
|
||||||
@ -21,8 +23,9 @@ from tests.base_cic import (
|
|||||||
root_unmerged_hash,
|
root_unmerged_hash,
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
logg.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class MockExt:
|
class MockExt:
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ class TestCICProcessor(TestCICBase):
|
|||||||
|
|
||||||
mock_ext = MockExt(self.token_address)
|
mock_ext = MockExt(self.token_address)
|
||||||
p = Processor(metadata=m, outputs_writer=self.outputs_writer, extensions=[mock_ext])
|
p = Processor(metadata=m, outputs_writer=self.outputs_writer, extensions=[mock_ext])
|
||||||
|
p.token_address = self.token_address
|
||||||
p.process()
|
p.process()
|
||||||
|
|
||||||
meta_reference = m.reference(self.token_address)
|
meta_reference = m.reference(self.token_address)
|
||||||
@ -62,8 +66,8 @@ class TestCICProcessor(TestCICBase):
|
|||||||
p = Processor(attachment=m, outputs_writer=self.outputs_writer, extensions=[mock_ext])
|
p = Processor(attachment=m, outputs_writer=self.outputs_writer, extensions=[mock_ext])
|
||||||
p.process()
|
p.process()
|
||||||
|
|
||||||
|
|
||||||
for k in list(m.contents.keys()):
|
for k in list(m.contents.keys()):
|
||||||
fp = os.path.join(self.outputs_dir, k)
|
|
||||||
os.stat(fp)
|
os.stat(fp)
|
||||||
|
|
||||||
|
|
||||||
|
1
tests/testdata/proof/proof.json
vendored
1
tests/testdata/proof/proof.json
vendored
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": 0,
|
"version": 0,
|
||||||
"namespace": "ge",
|
"namespace": "ge",
|
||||||
|
"issuer": "the man",
|
||||||
"description": "foo bar baz"
|
"description": "foo bar baz"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user