contracts/test/test_erc725.py
Ricardo Guilherme Schmidt 28f635f0ba update folder structure
2018-01-08 19:00:07 -06:00

31 lines
748 B
Python

import pytest
from ethereum import utils
from ethereum.tools import tester
from tests.setup_transaction_tests import assert_tx_failed, get_log
@pytest.fixture
def identiy_tester():
tester.s = tester.Chain()
from viper import compiler
tester.languages['viper'] = compiler.Compiler()
contract_code = open('contracts/identity/erc_725.v.py').read()
tester.c = tester.s.contract(
contract_code,
language='viper',
args=[]
)
return tester
def sign(_hash, key):
v, r, s = utils.ecsign(_hash, key)
return utils.encode_int32(r) + utils.encode_int32(s) + utils.encode_int(v)
def test_initial_state(identiy_tester):
c = tester.c
assert c.getKeysByType(1)[0] == '0x' + tester.a0.hex()