Esempio n. 1
0
def mock_structure(file_path=None, current_file=None, old_file=None):
    # type: (Optional[str], Optional[dict], Optional[dict]) -> StructureValidator
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'integration'
        structure.file_path = file_path
        structure.current_file = current_file
        structure.old_file = old_file
        return structure
Esempio n. 2
0
def mock_structure(file_path=None, current_file=None, old_file=None):
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'classifier'
        structure.file_path = file_path
        structure.current_file = current_file
        structure.old_file = old_file
        structure.prev_ver = 'master'
        structure.branch_name = ''
        return structure
def mock_structure(file_path=None, current_file=None, old_file=None):
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'genericfield'
        structure.file_path = file_path
        structure.current_file = current_file
        structure.old_file = old_file
        structure.prev_ver = 'master'
        structure.branch_name = ''
        structure.quiet_bc = False
        structure.skip_schema_check = False
        structure.pykwalify_logs = False
        structure.scheme_name = namedtuple('scheme_name',
                                           'value')(value='genericfield')
        structure.checked_files = set()
        structure.ignored_errors = dict()
        structure.suppress_print = True
        structure.json_file_path = None
        return structure
Esempio n. 4
0
def mock_structure(file_path=None, current_file=None, old_file=None):
    # type: (Optional[str], Optional[dict], Optional[dict]) -> StructureValidator
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'playbook'
        structure.file_path = file_path
        structure.current_file = current_file
        structure.old_file = old_file
        structure.prev_ver = 'master'
        structure.branch_name = ''
        return structure
Esempio n. 5
0
def mock_structure(file_path=None, current_file=None, old_file=None, quiet_bc=False):
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'widget'
        structure.file_path = file_path
        structure.current_file = current_file
        structure.old_file = old_file
        structure.prev_ver = 'master'
        structure.branch_name = ''
        structure.quiet_bc = quiet_bc
        structure.specific_validations = None
        return structure
Esempio n. 6
0
def mock_structure(file_path=None, current_file=None, old_file=None):
    with patch.object(StructureValidator, '__init__', lambda a, b: None):
        structure = StructureValidator(file_path)
        structure.is_valid = True
        structure.scheme_name = 'list'
        structure.file_path = file_path
        file = open(file_path, "r")
        structure.current_file = json.loads(file.read())
        file.close()
        structure.old_file = old_file
        structure.prev_ver = 'master'
        structure.branch_name = ''
        structure.quiet_bc = False
        return structure
Esempio n. 7
0
 def test_is_valid_file_path(self, path, answer, mocker):
     mocker.patch.object(StructureValidator, "load_data_from_file", return_value=None)
     structure = StructureValidator(path)
     structure.scheme_name = None
     assert structure.is_valid_file_path() is answer