def test_main(exists, mock_cfgcls, config, tmpdir): config["loglevel"] = "info" config["verbose"] = False config["logfile"] = unicode(tmpdir.join('spreads.log')) mock_cfgcls.return_value = config exists.return_value = False # NOTE: We mock out parser, since it interferes with pytest's parser with patch('spreads.cli.argparse.ArgumentParser'): cli.main()
def test_main(self, exists): # TODO: Config dumped? # TODO: Config from args? # TODO: Loglevel set correctly? # TODO: Correct function executed? cli.setup_parser = Mock() cli.config.dump = Mock() exists.return_value = False cli.os.path.exists = exists cli.main()
def test_main(self, exists): # TODO: Config dumped? # TODO: Config from args? # TODO: Loglevel set correctly? # TODO: Correct function executed? self.workflow.config["loglevel"] = "info" self.workflow.config["verbose"] = False self.workflow.config.dump = Mock() cli.confit.LazyConfig = Mock(return_value=self.workflow.config) cli.test_cmd = Mock() cli.setup_plugin_config = Mock() mock_parser = Mock() mock_args = Mock() mock_args.verbose = False mock_args.subcommand = Mock() mock_parser.parse_args = Mock(return_value=mock_args) cli.setup_parser = Mock(return_value=mock_parser) cli.set_config_from_args = Mock() exists.return_value = False cli.os.path.exists = exists cli.main() assert mock_args.subcommand.call_count == 1