def run(): print('test node.reset():') node.reset() print('test node.info():') node.info() print('test sess.init():') sess.init() print('test Template():') c = Template("hello-test3") print('test c.path():') c.path() print('test c.build():') c.build() print('test c.deploy():') c.deploy() print('test c.push_action("hi", sess.alice):') c.push_action("hi", '{"user":"******"}', sess.alice) print('test c.push_action("hi", sess.alice):') c.push_action("hi", '{"user":"******"}', sess.carol) print('test c.delete():') c.delete() print('test node.stop():') node.stop() print("Test OK")
def setUpClass(cls): with warnings.catch_warnings(): warnings.simplefilter("ignore") node.reset() sess.init() contract = Contract(CONTRACT_NAME) contract.deploy()
def run(): print('test node.reset():') node.reset() print('test node.info():') node.info() print('test sess.init():') sess.init() print('test Contract("eosio.token"):') c = Contract("eosio.token") print('test c.get_code():') c.get_code() print('test c.deploy():') c.deploy() print('test c.get_code():') c.get_code() print('test c.push_action("create"):') c.push_action("create", '{"issuer":"eosio", "maximum_supply":"1000000000.0000 EOS", "can_freeze":0, "can_recall":0, "can_whitelist":0}') print('test c.show_action("issue"):') c.show_action("issue", '{"to":"alice", "quantity":"100.0000 EOS", "memo":"memo"}', sess.eosio) print('test c.show_action("issue"):') c.show_action("issue", '{"to":"alice", "quantity":"100.0000 EOS", "memo":"memo"}', sess.eosio) print('test node.stop():') node.stop() print("Test OK")
def setUpClass(cls): with warnings.catch_warnings(): warnings.simplefilter("ignore") node.reset() sess.init() cls.contract = ContractFromTemplate( "_e4b2ffc804529ce9c6fae258197648cc2", remove_existing=True)
def run(): node.reset() sess.init() ############################ # Your unit-test goes here # ############################ node.stop() print("Test OK")
def run(): print("test node.reset():") node.reset() print("test sess.init():") sess.init() ############################ # Your unit-test goes here # ############################ print("test node.stop():") node.stop() print("Test OK")
def run(): print('test node.reset():') assert node.reset() print('test sess.init():') assert sess.init() print('test Contract():') c = Contract(CONTRACT_NAME) assert c.is_created() print('test c.deploy():') assert c.deploy() print('test c.get_code():') assert c.get_code() print('test c.push_action("hi", sess.alice):') assert c.push_action("hi", '{"user":"******"}', sess.alice) print('test c.push_action("hi", sess.carol):') assert c.push_action("hi", '{"user":"******"}', sess.carol) set_suppress_error_msg(True) print('test c.push_action("hi", sess.alice):') assert not c.push_action("hi", '{"user":"******"}', sess.alice) set_suppress_error_msg(False) print('test node.stop():') node.stop() print("Test OK")
def run(): print('test node.reset():') node.reset() print('test node.info():') node.info() print('test sess.init():') sess.init() print('test Contract("eosio.token"):') c = Contract("eosio.token") print('test c.get_code():') c.get_code() print('test c.deploy():') c.deploy() print('test c.get_code():') c.get_code() print('test c.push_action("create"):') c.push_action("create", '{"issuer":"eosio", "maximum_supply":"1000000000.0000 EOS", "can_freeze":0, "can_recall":0, "can_whitelist":0}') print('test c.push_action("issue"):') c.push_action("issue", '{"to":"alice", "quantity":"100.0000 EOS", "memo":"memo"}', sess.eosio) print('test c.push_action("transfer", sess.alice):') c.push_action("transfer", '{"from":"alice", "to":"carol", "quantity":"25.0000 EOS", "memo":"memo"}', sess.alice) print('test c.push_action("transfer", sess.carol):') c.push_action("transfer", '{"from":"carol", "to":"bob", "quantity":"13.0000 EOS", "memo":"memo"}', sess.carol) print('test c.push_action("transfer" sess.bob):') c.push_action("transfer", '{"from":"bob", "to":"alice", "quantity":"2.0000 EOS", "memo":"memo"}', sess.bob) print('testc.get_table("accounts", sess.alice):') t1=c.get_table("accounts", sess.alice) print('test c.get_table("accounts", sess.bob):') t2=c.get_table("accounts", sess.bob) print('test t3=c.get_table("accounts", sess.carol):') t3=c.get_table("accounts", sess.carol) print('assert t1.json["rows"][0]["balance"] == "77.0000 EOS":') assert t1.json["rows"][0]["balance"] == '77.0000 EOS' print('assert t2.json["rows"][0]["balance"] == "11.0000 EOS":') assert t2.json["rows"][0]["balance"] == '11.0000 EOS' print('assert t3.json["rows"][0]["balance"] == "12.0000 EOS":') assert t3.json["rows"][0]["balance"] == '12.0000 EOS' print('test node.stop():') node.stop() print("Test OK")
def run(): print('test node.reset():') node.reset() print('test node.info():') node.info() print('test sess.init():') sess.init() print('test Template():') c = Template("_e4b2ffc804529ce9c6fae258197648cc2", remove_existing=True) print('test c.path():') c.path() print('test c.build():') c.build() print('test c.deploy():') c.deploy() print('test c.push_action("hi", sess.alice):') c.push_action("hi", '{"user":"******"}', sess.alice) print('assert c.get_console() == "Hello, alice":') assert c.get_console() == "Hello, alice" print('test c.push_action("hi", sess.alice):') c.push_action("hi", '{"user":"******"}', sess.carol) print('assert c.get_console() == "Hello, carol":') assert c.get_console() == "Hello, carol" print('test c.delete():') c.delete() print('test node.stop():') node.stop() print("Test OK")
def run(): print('test node.reset():') assert node.reset() print('test sess.init():') assert sess.init() print('test ContractFromTemplate():') c = ContractFromTemplate("_e4b2ffc804529ce9c6fae258197648cc2", remove_existing=True) assert c.is_created() print('test c.build():') assert c.build() print('test c.deploy():') assert c.deploy() print('test c.get_code():') assert c.get_code() print('test c.push_action("hi", sess.alice):') assert c.push_action("hi", '{"user":"******"}', sess.alice) print('test c.push_action("hi", sess.carol):') assert c.push_action("hi", '{"user":"******"}', sess.carol) set_suppress_error_msg(True) print('test c.push_action("hi", sess.alice):') assert not c.push_action("hi", '{"user":"******"}', sess.alice) set_suppress_error_msg(False) print('test c.delete():') c.delete() print('test node.stop():') node.stop() print("Test OK")
#Run without exit: # comment out node.stop() # python3 -i script.py #create user #load hello.world and yourcontractname contract #deploy ############################################### import node import sess import eosf node.reset() sess.init() john = eosf.account(sess.eosio, name="john") sess.wallet.import_key(john) #change hello.world to yourcontractname contract = eosf.Contract(john, "hello.world") contract.build() contract.code() contract.deploy() contract.code() contract.push_action("hi", '["world"]') #contract = eosf.Contract(john, "yourcontractname") #contract.code()
def run(): print('test node.reset():') node.reset() print('test sess.init():') sess.init() print('test c = Contract("tic.tac.toe"):') c = Contract("tic.tac.toe") print('test c.deploy():') c.deploy() print('test c.push_action("create", sess.bob :') c.push_action("create", '{"challenger":"alice", "host":"bob"}', sess.bob) print('test t=c.get_table("games", sess.bob):') t = c.get_table("games", sess.bob) assert t.json["rows"][0]["board"][0] == '0' assert t.json["rows"][0]["board"][1] == '0' assert t.json["rows"][0]["board"][2] == '0' assert t.json["rows"][0]["board"][3] == '0' assert t.json["rows"][0]["board"][4] == '0' assert t.json["rows"][0]["board"][5] == '0' assert t.json["rows"][0]["board"][6] == '0' assert t.json["rows"][0]["board"][7] == '0' assert t.json["rows"][0]["board"][8] == '0' print('test c.push_action("move", sess.bob:') c.push_action( "move", '{"challenger":"alice", "host":"bob", "by":"bob", "mvt":{"row":0, "column":0} }', sess.bob) print('test c.push_action("move", sess.alice:') c.push_action( "move", '{"challenger":"alice", "host":"bob", "by":"alice", "mvt":{"row":1, "column":1} }', sess.alice) t = c.get_table("games", sess.bob) assert t.json["rows"][0]["board"][0] == '1' assert t.json["rows"][0]["board"][1] == '0' assert t.json["rows"][0]["board"][2] == '0' assert t.json["rows"][0]["board"][3] == '0' assert t.json["rows"][0]["board"][4] == '2' assert t.json["rows"][0]["board"][5] == '0' assert t.json["rows"][0]["board"][6] == '0' assert t.json["rows"][0]["board"][7] == '0' assert t.json["rows"][0]["board"][8] == '0' print('test c.push_action("restart", sess.bob:') c.push_action("restart", '{"challenger":"alice", "host":"bob", "by":"bob"}', sess.bob) print('test t=c.get_table("games", sess.bob):') t = c.get_table("games", sess.bob) assert t.json["rows"][0]["board"][0] == '0' assert t.json["rows"][0]["board"][1] == '0' assert t.json["rows"][0]["board"][2] == '0' assert t.json["rows"][0]["board"][3] == '0' assert t.json["rows"][0]["board"][4] == '0' assert t.json["rows"][0]["board"][5] == '0' assert t.json["rows"][0]["board"][6] == '0' assert t.json["rows"][0]["board"][7] == '0' assert t.json["rows"][0]["board"][8] == '0' print('test c.push_action("close", sess.bob:') c.push_action("close", '{"challenger":"alice", "host":"bob"}', sess.bob) print('test node.stop():') node.stop() print("Test OK")