help="If not specified, queue will not call back a connector.") output_file = click.option("-O", "--output-file", type=click.File("wb")) def schema_content_file(command: Optional[Callable] = None, **kwargs): default_kwargs = {"type": click.File("rb"), "help": "Schema file."} kwargs = {**default_kwargs, **kwargs} decorator = click.option("-s", "--schema-content-file", "schema_content_file_", **kwargs) if command is None: return decorator return decorator(command) schema_content = schema_content_factory(schema_content_file) def workspace_id(command: Optional[Callable] = None, **kwargs): default_kwargs = {"type": int, "help": "Workspace ID."} kwargs = {**default_kwargs, **kwargs} decorator = click.option("-w", "--workspace-id", **kwargs) if command is None: return decorator return decorator(command) def queue(command: Optional[Callable] = None, related_object: Optional[str] = "object", **kwargs): default_kwargs = {
from elisctl.common import schema_content_factory from elisctl.schema.xlsx import XlsxToSchema def file_decorator(*_args, **_kwargs): def test_decorator(f): def test_wrapped(*args, **kwargs): return f(*args, **kwargs) return test_wrapped return test_decorator parameter = schema_content_factory(file_decorator) class TestSchemaContent: def test_json(self): command = mock.Mock() with io.BytesIO(b"{}") as buffer: parameter(command)(schema_content_file_=buffer) command.assert_called_once_with(schema_content={}) def test_xlsx(self): command = mock.Mock() with io.BytesIO(b"<mock xlsx>") as buffer, mock.patch.object( XlsxToSchema,