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
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
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)
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)
def test_zencontract(): smart_contract = ZenContract(CONTRACTS.GENERATE_KEYPAIR) assert smart_contract assert not smart_contract.data() assert not smart_contract.keys()
def test_keys(): smart_contract = ZenContract(CONTRACTS.GENERATE_KEYPAIR) smart_contract.keys("test") assert smart_contract.keys() == "test"