def __init__(self, file_path, old_file_path=None, predefined_scheme=None, configuration=Configuration()): # type: (str, Optional[str], Optional[str], Configuration) -> None self.is_valid = True self.file_path = file_path self.scheme_name = predefined_scheme or self.scheme_of_file_by_path() self.file_type = self.get_file_type() self.current_file = self.load_data_from_file() self.old_file = get_remote_file( old_file_path) if old_file_path else get_remote_file(file_path) self.configuration = configuration
def test_get_remote_file_invalid_origin_branch(self): invalid_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml', 'origin/NoSuchBranch') assert not invalid_yml
def test_get_remote_file_origin_tag(self): gmail_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml', 'origin/19.10.0') assert gmail_yml assert gmail_yml['commonfields']['id'] == 'Gmail'
def test_get_remote_file_invalid(self): invalid_yml = tools.get_remote_file('Integrations/File/File.yml', '19.10.0') assert not invalid_yml
def test_get_remote_file_sanity(self): gmail_yml = tools.get_remote_file('Integrations/Gmail/Gmail.yml') assert gmail_yml assert gmail_yml['commonfields']['id'] == 'Gmail'