def test_is_valid_autoextract_no_extract_rules(): """ Given - an incident type without auto extract section . When - Running is_valid_autoextract on it. Then - Ensure returns True. """ structure = StructureValidator("") validator = IncidentTypeValidator(structure) assert validator.is_valid_autoextract()
def test_is_valid_autoextract_fields(extract_field, answer): """ Given - an incident type with a valid or invalid auto extract section . When - Running is_valid_autoextract on it. Then - Ensure returns True if the field is formatted correctly and False otherwise. """ structure = StructureValidator("") validator = IncidentTypeValidator(structure) validator.current_file['extractSettings'] = { 'mode': "All", 'fieldCliNameToExtractSettings': { "incident_field": extract_field } } assert validator.is_valid_autoextract() is answer
def test_is_valid_autoextract_mode(extract_mode, answer): """ Given - an incident type with a valid or invalid auto extract mode. When - Running is_valid_autoextract on it. Then - Ensure returns True if the field is formatted correctly and False otherwise. """ structure = StructureValidator("") validator = IncidentTypeValidator(structure) validator.current_file['extractSettings'] = { 'mode': extract_mode, 'fieldCliNameToExtractSettings': { "incident_field": { "extractAsIsIndicatorTypeId": "", "isExtractingAllIndicatorTypes": False, "extractIndicatorTypesIDs": [] } } } assert validator.is_valid_autoextract() is answer