Exemple #1
0
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")
Exemple #2
0
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")
Exemple #3
0
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")
Exemple #4
0
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")
Exemple #5
0
def run():
    print('test node.reset():')
    node.reset()
    print('test node.info():')
    node.info()
    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")