Exemplo n.º 1
0
def main(prog_name=os.path.basename(sys.argv[0]), args=None,
         with_loggers=True):
    parser = create_parser(prog_name)
    if args is None:
        args = sys.argv[1:]
    args = parser.parse_args(args)

    if with_loggers is True:
        if args.verbose is None:
            verbose_level = 0
        else:
            verbose_level = args.verbose
        setup_loggers(verbose_level=verbose_level)

    if args.command == 'admin':
        do_admin(args)
    elif args.command == 'keygen':
        do_keygen(args)
    elif args.command == 'config':
        do_config(args)
    elif args.command == 'block':
        do_block(args)
    elif args.command == 'batch':
        do_batch(args)
    elif args.command == 'transaction':
        do_transaction(args)
    elif args.command == 'state':
        do_state(args)
    elif args.command == 'cluster':
        do_cluster(args)
    elif args.command == 'identity':
        do_identity(args)
    else:
        raise AssertionError("invalid command: {}".format(args.command))
Exemplo n.º 2
0
def main(prog_name=os.path.basename(sys.argv[0]), args=None,
         with_loggers=True):
    parser = create_parser(prog_name)
    if args is None:
        args = sys.argv[1:]
    args = parser.parse_args(args)

    if with_loggers is True:
        if args.verbose is None:
            verbose_level = 0
        else:
            verbose_level = args.verbose
        setup_loggers(verbose_level=verbose_level)

    if args.command == 'admin':
        do_admin(args)
    elif args.command == 'keygen':
        do_keygen(args)
    elif args.command == 'config':
        do_config(args)
    elif args.command == 'block':
        do_block(args)
    elif args.command == 'batch':
        do_batch(args)
    elif args.command == 'transaction':
        do_transaction(args)
    elif args.command == 'state':
        do_state(args)
    elif args.command == 'cluster':
        do_cluster(args)
    else:
        raise AssertionError("invalid command: {}".format(args.command))
Exemplo n.º 3
0
    def test_set_value_creates_batch_list(self):
        args = self._parse_set_command('x=1', 'y=1')
        config.do_config(args)

        batch_list = self._read_target_file_as(BatchList)

        self.assertEqual(1, len(batch_list.batches))

        batch_header = BatchHeader()
        batch_header.ParseFromString(batch_list.batches[0].header)
        self.assertEqual(2, len(batch_header.transaction_ids))
Exemplo n.º 4
0
def main(prog_name=os.path.basename(sys.argv[0]), args=sys.argv[1:],
         with_loggers=True):
    parser = create_parser(prog_name)
    args = parser.parse_args(args)

    if with_loggers is True:
        if args.verbose is None:
            verbose_level = 0
        else:
            verbose_level = args.verbose
        setup_loggers(verbose_level=verbose_level)

    if args.command == 'admin':
        do_admin(args)
    elif args.command == 'keygen':
        do_keygen(args)
    elif args.command == 'config':
        do_config(args)
    else:
        raise AssertionError("invalid command: {}".format(args.command))