def test_valid_pipeline(): pipeline_json = _read_pipeline_resource( "resources/sample_pipelines/pipeline_valid.json") pipeline_definition = PipelineDefinition(pipeline_definition=pipeline_json) assert pipeline_definition.is_valid()
def _check_missing_primary_pipeline_field(field: str, error_msg: str): pipeline_json = _read_pipeline_resource( "resources/sample_pipelines/pipeline_valid.json") pipeline_json["pipelines"][0].pop(field) pipeline_definition = PipelineDefinition(pipeline_definition=pipeline_json) assert pipeline_definition.is_valid() is False assert error_msg in pipeline_definition.validate()
def test_validation_flags_missing_version_field(): pipeline_json = _read_pipeline_resource( "resources/sample_pipelines/pipeline_valid.json") pipeline_json["pipelines"][0]["app_data"].pop("version") pipeline_definition = PipelineDefinition(pipeline_definition=pipeline_json) assert pipeline_definition.is_valid() is False assert "Primary pipeline is missing the 'version' field." in pipeline_definition.validate( )
def _check_pipeline_field_type(field: str, wrong_type_value: any, error_msg: str): pipeline_json = _read_pipeline_resource( "resources/sample_pipelines/pipeline_valid.json") pipeline_json.pop(field) pipeline_json[field] = wrong_type_value pipeline_definition = PipelineDefinition(pipeline_definition=pipeline_json) assert pipeline_definition.is_valid() is False assert error_msg in pipeline_definition.validate()