def test_valid_file_in_directory(self): zip_file = ZipFile(io.BytesIO(), 'a') zip_file.writestr('test/test.txt', 'testdata') paths = TruegazeUtils.get_matching_paths_from_zip( zip_file, re.compile(r'.*est.*\.txt')) assert len(paths) == 1 assert paths[0] == 'test/test.txt'
def test_valid_one_file(self): zip_file = ZipFile(io.BytesIO(), 'a') zip_file.writestr('test', '') paths = TruegazeUtils.get_matching_paths_from_zip( zip_file, re.compile(r'.*')) assert len(paths) == 1 assert paths[0] == 'test'
def test_valid_three_files(self): zip_file = ZipFile(io.BytesIO(), 'a') zip_file.writestr('test1.txt', '') zip_file.writestr('test/test2.doc', '') zip_file.writestr('test/test/test3.md', '') paths = TruegazeUtils.get_matching_paths_from_zip( zip_file, re.compile(r'.*est/test.*\..*')) assert len(paths) == 2 assert paths[0] == 'test/test2.doc' assert paths[1] == 'test/test/test3.md'
def get_paths(zip_file): return TruegazeUtils.get_matching_paths_from_zip( zip_file, CONFIG_FILE_PATTERN)
def test_empty(self): zip_file = ZipFile(io.BytesIO(), 'a') paths = TruegazeUtils.get_matching_paths_from_zip( zip_file, re.compile(r'.*')) assert len(paths) == 0