예제 #1
0
파일: validator.py 프로젝트: SergK/git-repo
def validate_file_by_schema(schema, file_path):
    if not utils.file_exists(file_path):
        raise error.FileDoesNotExist(file_path)

    data = utils.parse_yaml(file_path)
    if data is not None:
        validate_schema(data, schema, file_path)
    else:
        raise error.FileIsEmpty(file_path)
    return data
예제 #2
0
def validate_file_by_schema(schema, file_path):
    if not utils.file_exists(file_path):
        raise error.FileDoesNotExist(file_path)

    data = utils.parse_yaml(file_path)
    if data is not None:
        validate_schema(data, schema, file_path)
    else:
        raise error.FileIsEmpty(file_path)
    return data
예제 #3
0
파일: sync.py 프로젝트: TechAbib/git-repo-1
 def _projects_file(path):
     if not utils.file_exists(path):
         raise argparse.ArgumentTypeError(
             'File "{0}" does not exists'.format(path))
     return path
예제 #4
0
파일: sync.py 프로젝트: SergK/git-repo
 def _projects_file(path):
     if not utils.file_exists(path):
         raise argparse.ArgumentTypeError(
             'File "{0}" does not exists'.format(path))
     return path
예제 #5
0
 def test_file_exists(self, lexists_mock):
     self.assertTrue(utils.file_exists("file1"))
     self.assertFalse(utils.file_exists("file2"))
     self.assertEqual(
         lexists_mock.call_args_list,
         [mock.call("file1"), mock.call("file2")])
예제 #6
0
 def test_file_exists(self, lexists_mock):
     self.assertTrue(utils.file_exists('file1'))
     self.assertFalse(utils.file_exists('file2'))
     self.assertEqual(lexists_mock.call_args_list,
                      [mock.call('file1'), mock.call('file2')])