Esempio n. 1
0
 def test_valid_release_notes_structure(self, source_dummy, target_dummy,
                                        source_release_notes, target_release_notes, validator, answer, mocker):
     # type: (str, str, str, str, Type[ContentEntityValidator], Any) -> None
     try:
         copyfile(source_dummy, target_dummy)
         copyfile(source_release_notes, target_release_notes)
         mocker.patch.object(OldReleaseNotesValidator, 'get_master_diff', side_effect=self.mock_get_master_diff)
         validator = OldReleaseNotesValidator(target_dummy)
         assert validator.is_valid_release_notes_structure() is answer
     finally:
         os.remove(target_dummy)
         os.remove(target_release_notes)
Esempio n. 2
0
 def test_is_release_notes_exists(self, source_dummy, target_dummy,
                                  source_release_notes, target_release_notes, validator, answer, mocker):
     # type: (str, str, str, str, Type[ContentEntityValidator], Any, Any) -> None
     try:
         copyfile(source_dummy, target_dummy)
         copyfile(source_release_notes, target_release_notes)
         mocker.patch.object(BaseValidator, 'check_file_flags', return_value='')
         mocker.patch.object(OldReleaseNotesValidator, 'get_master_diff', side_effect=self.mock_get_master_diff)
         res_validator = OldReleaseNotesValidator(target_dummy)
         assert res_validator.validate_file_release_notes_exists() is answer
     finally:
         os.remove(target_dummy)
         os.remove(target_release_notes)
Esempio n. 3
0
def get_validator(file_path='', diff=''):
    release_notes_validator = OldReleaseNotesValidator("")
    release_notes_validator.file_path = file_path
    release_notes_validator.release_notes_path = file_path
    release_notes_validator.release_notes = file_path
    release_notes_validator.master_diff = diff
    release_notes_validator.ignored_errors = {}
    release_notes_validator.checked_files = set()
    release_notes_validator.json_file_path = ''
    return release_notes_validator
Esempio n. 4
0
def get_validator(file_path='', diff=''):
    release_notes_validator = OldReleaseNotesValidator("")
    release_notes_validator.file_path = file_path
    release_notes_validator.release_notes_path = file_path
    release_notes_validator.release_notes = file_path
    release_notes_validator.master_diff = diff
    release_notes_validator.ignored_errors = {}
    release_notes_validator.checked_files = set()
    release_notes_validator.json_file_path = ''
    release_notes_validator.specific_validations = None
    release_notes_validator.predefined_by_support_ignored_errors = {}
    release_notes_validator.predefined_deprecated_ignored_errors = {}
    return release_notes_validator