Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_validate_ocrd_tool(self):
with TemporaryDirectory() as tempdir:
json_path = Path(tempdir, 'ocrd-tool.json')
json_path.write_text(OCRD_TOOL)
# normal call
result = self.runner.invoke(validate_cli, ['tool-json', str(json_path)])
self.assertEqual(result.exit_code, 0)
# relative path
with pushd_popd(tempdir):
result = self.runner.invoke(validate_cli, ['tool-json', 'ocrd-tool.json'])
self.assertEqual(result.exit_code, 0)
# default path
with pushd_popd(tempdir):
result = self.runner.invoke(validate_cli, ['tool-json'])
self.assertEqual(result.exit_code, 0)
def test_validate_parameter(self):
with TemporaryDirectory() as tempdir:
json_path = Path(tempdir, 'ocrd-tool.json')
json_path.write_text(OCRD_TOOL)
with pushd_popd(tempdir):
result = self.runner.invoke(validate_cli, ['parameters', 'ocrd-tool.json', 'ocrd-xyz', dumps({"baz": "foo"})])
self.assertEqual(result.exit_code, 0)
from .log import log_cli
@click.group()
@click.version_option()
@ocrd_loglevel
def cli(**kwargs): # pylint: disable=unused-argument
"""
CLI to OCR-D
"""
cli.add_command(ocrd_tool_cli)
cli.add_command(workspace_cli)
cli.add_command(process_cli)
cli.add_command(bashlib_cli)
cli.add_command(zip_cli)
cli.add_command(validate_cli)
cli.add_command(log_cli)