Beispiel #1
0
    def test_validation_fails_missing_dep(self):
        batches = [
            self.make_batch('batch1', transaction('id1', []),
                            transaction('id2', []), transaction('id3', [])),
            self.make_batch('batch2', transaction('id4', ['id11']))
        ]

        args = self._parse_command(batches)
        with self.assertRaises(CliException):
            genesis.do_genesis(args)
Beispiel #2
0
    def test_validate_with_deps_in_across_batches(self):
        batches = [
            self.make_batch('batch1', transaction('id1', []),
                            transaction('id2', []), transaction('id3', [])),
            self.make_batch('batch2', transaction('id4', ['id1', 'id2']))
        ]

        args = self._parse_command(batches)
        genesis.do_genesis(args)

        output = self._result_data()
        self.assertEqual(2, len(output.batches))
Beispiel #3
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 == 'keygen':
        do_keygen(args)
    elif args.command == 'genesis':
        do_genesis(args)
    elif args.command == 'config':
        do_config(args)
    else:
        raise AssertionError("invalid command: {}".format(args.command))