示例#1
0
def execute_contract(contractName, keys=None, data=None):
    contract = ZenContract(contractName)
    contract.keys(keys)
    contract.data(data)
    result = contract.execute()
    if (result != None) and result.startswith("{"):
        print_json(contractName, result)
    else:
        print(contractName + ":\n" + result)
    return result
示例#2
0
def execute_contract(contractName, keys=None, data=None):
    contract = ZenContract(contractName)
    contract.keys(keys)
    contract.data(data)
    res = contract.execute()
    if debug_zen is 1:
        if (res is not None) and res.startswith("{"):
            print_json(contractName, res)
        else:
            print(contractName + ":\n" + res)
    return res
示例#3
0
def test_request():
    keys = ZenContract(CONTRACTS.CITIZEN_KEYGEN).execute()
    expected = "request pi_s rk rr cm public".split()
    contract = ZenContract(CONTRACTS.CITIZEN_REQ_BLIND_SIG)
    contract.keys(keys)
    _smart_contract_check(contract, expected)
示例#4
0
def test_keygen():
    expected = "identifier public private".split()
    contract = ZenContract(CONTRACTS.CITIZEN_KEYGEN)
    _smart_contract_check(contract, expected)
示例#5
0
def test_issuer_public():
    expected = "issuer_identifier verify beta alpha".split()
    contract = ZenContract(CONTRACTS.PUBLIC_VERIFY)
    contract.keys(ZenContract(CONTRACTS.GENERATE_KEYPAIR).execute())
    _smart_contract_check(contract, expected)
示例#6
0
def test_execute():
    expected = ["encoding", "x", "zenroom", "sign", "schema", "curve"]
    contract = ZenContract(CONTRACTS.GENERATE_KEYPAIR)
    _smart_contract_check(contract, expected)
示例#7
0
def test_zencontract():
    smart_contract = ZenContract(CONTRACTS.GENERATE_KEYPAIR)
    assert smart_contract
    assert not smart_contract.data()
    assert not smart_contract.keys()
示例#8
0
def test_keys():
    smart_contract = ZenContract(CONTRACTS.GENERATE_KEYPAIR)
    smart_contract.keys("test")

    assert smart_contract.keys() == "test"