示例#1
0
        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,
                           args.wif)
        wallet.set_and_run_wallet()

        creator, receiver = make_user_for_tests(wallet)

        proposals_before = len(
            find_creator_proposals(
                creator,
                last_message_as_json(
                    wallet.list_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:
示例#2
0
                            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")
        proposals_after = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", "") )))

        log.info("proposals_after {0}".format(proposals_after))

        if not proposals_before == proposals_middle:
            raise ArgsCheckException("proposals_before should be equal to proposals_middle.")
示例#3
0
                            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")
        proposals_after = len(find_voter_proposals(creator, last_message_as_json( wallet.list_voter_proposals(creator, "creator", "asc", 20, "all", "") )))

        log.info("proposals_after {0}".format(proposals_after))

        if not proposals_before == proposals_middle:
            raise ArgsCheckException("proposals_before should be equal to proposals_middle.")
        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_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_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_proposals(args.creator, "creator", "asc", 50, "all", "10")
        log.info(resp_10)
        if resp_10.find(error_msg_10) != -1:
            raise ArgsCheckException("There should be no assertion `{0}`.".format(error_msg_10))
        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()

        creator, receiver = make_user_for_tests(wallet)

        proposals_before = len(find_creator_proposals(creator, last_message_as_json( wallet.list_proposals(creator, "creator", "asc", 50, "all"))))
        log.info("proposals_before {0}".format(proposals_before))

        wallet.post_comment(creator, "lorem", "", "ipsum", "Lorem Ipsum", "body", "{}", "true")
        create_prop = wallet.create_proposal(creator, receiver, "2029-06-02T00:00:00", "2029-08-01T00:00:00", "-1.000 TBD", "this is subject", "lorem", "true")
        if not create_prop.find("daily_pay.amount >= 0: Daily pay can't be negative value") != -1:
            raise ArgsCheckException("Assertion `{0}` is required.".format("daily_pay.amount >= 0: Daily pay can't be negative value"))

        proposals_after = len(find_creator_proposals(creator, last_message_as_json( wallet.list_proposals(creator, "creator", "asc", 50, "all"))))
        log.info("proposals_after {0}".format(proposals_after))
        
        if not proposals_before == proposals_after:
            raise ArgsCheckException("proposals_before +1 should be equal to proposals_after.")

    except Exception as _ex:
        log.exception(str(_ex))
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_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_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_proposals(args.creator, "creator", "asc", 50,