def __init__(self, file_path, check_git=True, old_file_path=None, old_git_branch='master'): self.file_path = file_path self.current_incident_field = {} self.old_incident_field = {} if check_git: self.current_incident_field = get_json(file_path) if old_file_path: self.old_incident_field = get_remote_file( old_file_path, old_git_branch) else: self.old_incident_field = get_remote_file( file_path, old_git_branch)
def __init__(self, file_path, check_git=True, old_file_path=None, old_git_branch='master'): self._is_valid = True self.file_path = file_path if check_git: self.current_integration = get_yaml(file_path) old_integration_file = old_file_path or file_path self.old_integration = get_remote_file(old_integration_file, old_git_branch)
def __init__(self, file_path, check_git=True, old_file_path=None, old_git_branch='master'): self.file_path = file_path self.current_script = {} self.old_script = {} if check_git: self.current_script = get_yaml(file_path) old_script_file = old_file_path or file_path self.old_script = get_remote_file(old_script_file, old_git_branch)
def handle_deleted_file(full_file_name, git_sha1): """ Create release note for deleted file. :param full_file_name: path to file in repository :param git_sha1: git_sha1 to compare to :return: None """ data = get_remote_file(full_file_name, git_sha1) name = data.get('name') or data.get('name') or full_file_name file_type = full_file_name.split("/")[0] file_type_mapping = RELEASE_NOTE_GENERATOR.get(file_type) if file_type_mapping is not None: file_type_mapping.add('D', name)
def test_get_remote_file_origin(self): gmail_yml = test_utils.get_remote_file('Integrations/Gmail/Gmail.yml', 'master') assert gmail_yml assert gmail_yml['commonfields']['id'] == 'Gmail'
def test_get_remote_file_invalid_origin_branch(self): invalid_yml = test_utils.get_remote_file('Integrations/Gmail/Gmail.yml', 'origin/NoSuchBranch') assert not invalid_yml
def test_get_remote_file_invalid(self): invalid_yml = test_utils.get_remote_file('Integrations/File/File.yml', '19.10.0') assert not invalid_yml
def test_get_remote_file_tag(self): gmail_yml = test_utils.get_remote_file('Integrations/Gmail/Gmail.yml', '19.10.0') assert gmail_yml assert gmail_yml['commonfields']['id'] == 'Gmail'