def test_schema_cfngin_output(cd_tmp_path: Path) -> None: """Test ``runway schema cfngin --output cfngin-schema.json``.""" file_path = cd_tmp_path / "cfngin-schema.json" result = CliRunner().invoke( cli, ["schema", "cfngin", "--output", file_path.name]) assert result.exit_code == 0 assert str(file_path) in result.output assert file_path.is_file() assert (file_path.read_text() == CfnginConfigDefinitionModel.schema_json( indent=4) + "\n")
def build_schema(cfngin: bool, runway: bool) -> None: """Build vscode-runway schemas. By default, both schemas are built. """ if not runway: click.secho("building CFNgin schema...", fg="yellow") CFNGIN_SCHEMA.write_text( CfnginConfigDefinitionModel.schema_json(indent=4)) click.secho(f"successfully output CFNgin schema to {CFNGIN_SCHEMA}", fg="green") if not cfngin: click.secho("building Runway schema...", fg="yellow") RUNWAY_SCHEMA.write_text( RunwayConfigDefinitionModel.schema_json(indent=4)) click.secho(f"successfully output Runway schema to {CFNGIN_SCHEMA}", fg="green")
def test_schema_cfngin_indent() -> None: """Test ``runway schema cfngin --indent 2``.""" result = CliRunner().invoke(cli, ["schema", "cfngin", "--indent", "2"]) assert result.exit_code == 0 assert result.output == CfnginConfigDefinitionModel.schema_json( indent=2) + "\n"