コード例 #1
0
    def test_validate_with_default_output(self):
        """Tests that the genesis batch is created and placed in the data dir,
        which is the default location, when no output file is specified in the
        command args..
        """
        args = self._parse_command([], with_default_output=True)
        genesis.do_genesis(args, self._temp_data_dir)

        output = self._result_data(target_dir=self._temp_data_dir)
        self.assertEqual(0, len(output.batches))
コード例 #2
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, self._temp_data_dir)
コード例 #3
0
    def test_validate_with_no_deps(self):
        batches = [
            self.make_batch('batch1', transaction('id1', []),
                            transaction('id2', []), transaction('id3', [])),
            self.make_batch('batch2', transaction('id4', []))
        ]

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

        output = self._result_data()
        self.assertEqual(2, len(output.batches))
コード例 #4
0
    def test_validate_with_no_input_batches(self):
        args = self._parse_command([])
        genesis.do_genesis(args, self._temp_data_dir)

        output = self._result_data()
        self.assertEqual(0, len(output.batches))