from utils.cmd_args import args
from utils.cli_wallet import CliWallet
from utils.logger import log, init_logger

if __name__ == "__main__":
    try:
        init_logger(__file__)
        error = False
        wallet = CliWallet(args.path, args.server_rpc_endpoint, args.cert_auth,
                           args.rpc_tls_endpoint, args.rpc_tls_cert,
                           args.rpc_http_endpoint, args.deamon,
                           args.rpc_allowip, args.wallet_file, args.chain_id)
        wallet.set_and_run_wallet()

        error_msg_x = "The value `x` for `_last_id` argument is invalid, it should be integer type."
        resp_error_x = wallet.list_voter_proposals(args.creator, "creator",
                                                   "asc", 50, "all", "x")
        log.info(resp_error_x)
        if resp_error_x.find(error_msg_x) == -1:
            raise ArgsCheckException(
                "Assertion `{0}` is required.".format(error_msg_x))

        error_msg_y = "The value `y` for `_last_id` argument is invalid, it should be integer type."
        resp_error_y = wallet.list_voter_proposals(args.creator, "creator",
                                                   "asc", 50, "all", "y")
        log.info(resp_error_y)
        if resp_error_y.find(error_msg_y) == -1:
            raise ArgsCheckException(
                "Assertion `{0}` is required.".format(error_msg_y))

        error_msg_10 = "The value `10` for `_last_id` argument is invalid, it should be integer type."
        resp_10 = wallet.list_voter_proposals(args.creator, "creator", "asc",
Пример #2
0
        wallet = CliWallet( args.path,
                            args.server_rpc_endpoint,
                            args.cert_auth,
                            #args.rpc_endpoint,
                            args.rpc_tls_endpoint,
                            args.rpc_tls_cert,
                            args.rpc_http_endpoint,
                            args.deamon, 
                            args.rpc_allowip,
                            args.wallet_file,
                            args.chain_id  )
        wallet.set_and_run_wallet()

        creator, receiver = make_user_for_tests(wallet)

        proposals_before = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", "") )))
        log.info("proposals_before {0}".format(proposals_before))

        wallet.post_comment(creator, "lorem", "", "ipsum", "Lorem Ipsum", "body", "{}", "true")
        wallet.create_proposal(creator, receiver, "2029-06-02T00:00:00", "2029-08-01T00:00:00", "1.000 TBD", "this is subject", "lorem", "true")
        
        resp = find_creator_proposals(creator, last_message_as_json(wallet.list_proposals(creator, "creator", "asc", 50, "all", "")))
        new_proposal_id = 0
        for r in resp:
            if r["id"] > new_proposal_id:
                new_proposal_id = r["id"]

        proposals_middle = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", ""))))
        log.info("proposals_middle {0}".format(proposals_middle))

        wallet.update_proposal_votes(creator, [new_proposal_id], "true", "true")
Пример #3
0
        wallet = CliWallet( args.path,
                            args.server_rpc_endpoint,
                            args.cert_auth,
                            args.rpc_tls_endpoint,
                            args.rpc_tls_cert,
                            args.rpc_http_endpoint,
                            args.deamon, 
                            args.rpc_allowip,
                            args.wallet_file,
                            args.chain_id,
                            args.wif )
        wallet.set_and_run_wallet()

        creator, receiver = make_user_for_tests(wallet)

        proposals_before = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", "") )))
        log.info("proposals_before {0}".format(proposals_before))

        wallet.post_comment(creator, "lorem", "", "ipsum", "Lorem Ipsum", "body", "{}", "true")
        wallet.create_proposal(creator, receiver, "2029-06-02T00:00:00", "2029-08-01T00:00:00", "1.000 TBD", "this is subject", "lorem", "true")
        
        resp = find_creator_proposals(creator, last_message_as_json(wallet.list_proposals(creator, "creator", "asc", 50, "all", "")))
        new_proposal_id = 0
        for r in resp:
            if r["id"] > new_proposal_id:
                new_proposal_id = r["id"]

        proposals_middle = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", ""))))
        log.info("proposals_middle {0}".format(proposals_middle))

        wallet.update_proposal_votes(creator, [new_proposal_id], "true", "true")
Пример #4
0
            args.rpc_tls_endpoint,
            args.rpc_tls_cert,
            args.rpc_http_endpoint,
            args.deamon,
            args.rpc_allowip,
            args.wallet_file,
            args.chain_id)
        wallet.set_and_run_wallet()

        creator, receiver = make_user_for_tests(wallet)

        proposals_before = len(
            find_voter_proposals(
                creator,
                last_message_as_json(
                    wallet.list_voter_proposals(creator, "creator", "asc", 20,
                                                "all", ""))))
        log.info("proposals_before {0}".format(proposals_before))

        wallet.post_comment(creator, "lorem", "", "ipsum", "Lorem Ipsum",
                            "body", "{}", "true")
        wallet.create_proposal(creator, receiver, "2029-06-02T00:00:00",
                               "2029-08-01T00:00:00", "1.000 TBD",
                               "this is subject", "lorem", "true")

        resp = find_creator_proposals(
            creator,
            last_message_as_json(
                wallet.list_proposals(creator, "creator", "asc", 50, "all",
                                      "")))
        new_proposal_id = 0
        for r in resp: