Пример #1
0
    def setUp(self):
        self._parser = argparse.ArgumentParser(add_help=False)

        parent_parser = argparse.ArgumentParser(prog='test_keygen',
                                                add_help=False)

        subparsers = self._parser.add_subparsers(title='subcommands',
                                                 dest='command')

        keygen.add_keygen_parser(subparsers, parent_parser)
Пример #2
0
    def setUp(self):
        self._parser = argparse.ArgumentParser(add_help=False)

        parent_parser = argparse.ArgumentParser(prog='test_keygen',
                                                add_help=False)

        subparsers = self._parser.add_subparsers(title='subcommands',
                                                 dest='command')

        keygen.add_keygen_parser(subparsers, parent_parser)
Пример #3
0
def add_admin_parser(subparsers, parent_parser):
    parser = subparsers.add_parser(
        'admin',
        help='Create validator keys and help create the genesis block',
        description='Provides subcommands to create validator keys and '
        'help create the genesis block',
        parents=[parent_parser])
    admin_sub = parser.add_subparsers(title='subcommands', dest='subcommand')
    admin_sub.required = True
    add_genesis_parser(admin_sub, parent_parser)
    add_keygen_parser(admin_sub, parent_parser)
Пример #4
0
def create_parser(prog_name):
    parent_parser = create_parent_parser(prog_name)

    parser = argparse.ArgumentParser(
        description='Provides subcommands to create validator keys and '
        'create the genesis block',
        parents=[parent_parser],)

    subparsers = parser.add_subparsers(title='subcommands', dest='subcommand')
    subparsers.required = True

    add_genesis_parser(subparsers, parent_parser)
    add_keygen_parser(subparsers, parent_parser)

    return parser
Пример #5
0
def create_parser(prog_name):
    parent_parser = create_parent_parser(prog_name)

    parser = argparse.ArgumentParser(
        description='Provides subcommands to create validator keys and '
        'create the genesis block',
        parents=[parent_parser],
    )

    subparsers = parser.add_subparsers(title='subcommands', dest='subcommand')
    subparsers.required = True

    add_genesis_parser(subparsers, parent_parser)
    add_keygen_parser(subparsers, parent_parser)

    return parser
Пример #6
0
    def do_test_add_keygen_parser():
        _parser = argparse.ArgumentParser(add_help=False)
        parent_parser = argparse.ArgumentParser(prog='test_keygen', add_help=False)
        subparsers = _parser.add_subparsers(title='subcommands', dest='command')
        add_keygen_parser(subparsers=subparsers, parent_parser=parent_parser)


# def test_do_keygen(benchmark):
#     _parser = argparse.ArgumentParser(add_help=False)

#     def _parse_keygen_command(*args):
#         cmd_args = ['keygen']
#         cmd_args += args
#         return _parser.parse_args(cmd_args)

#     parent_parser = argparse.ArgumentParser(prog='test_keygen', add_help=False)
#     subparsers = _parser.add_subparsers(title='subcommands', dest='command')
#     keygen.add_keygen_parser(subparsers, parent_parser)
#     TEST_KEY = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(32)])
#     args = _parse_keygen_command(TEST_KEY)

#     benchmark.pedantic(keygen.do_keygen, kwargs = {'args':args}, \
#     iterations=ITERATIONS, rounds=ROUNDS)
Пример #7
0
def add_admin_parser(subparsers, parent_parser):
    parser = subparsers.add_parser('admin', parents=[parent_parser])
    admin_sub = parser.add_subparsers(title='admin_commands', dest='admin_cmd')
    admin_sub.required = True
    add_genesis_parser(admin_sub, parent_parser)
    add_keygen_parser(admin_sub, parent_parser)
Пример #8
0
def add_admin_parser(subparsers, parent_parser):
    parser = subparsers.add_parser('admin', parents=[parent_parser])
    admin_sub = parser.add_subparsers(title='subcommands', dest='subcommand')
    admin_sub.required = True
    add_genesis_parser(admin_sub, parent_parser)
    add_keygen_parser(admin_sub, parent_parser)