def test_tar_no_separator(self): files = ('gzip1.flat/a', 'gzip1.flat/bar1', 'gzip1.flat/bar2', 'gzip1.flat/bb', 'gzip1.flat/ccc', 'gzip1.flat/foo1', 'gzip1.flat/foo2') with self.Silence(): g = Tar.Tar('tests/tar/gzip1.tar.gz', False) processed = self.list_files(g.flat_dir) self.assertEqual(set(files), processed)
def test_tar_bad_separator(self): try: with self.Silence(): g = Tar.Tar('tests/tar/gzip4.tar.gz') processed = self.list_files(g.flat_dir) except SystemExit: pass else: self.fail('SystemExit exception expected')
def test_tar_separator(self): files = ('gzip1.flat/bar#1#a', 'gzip1.flat/bar#22#bb', 'gzip1.flat/bar#333#ccc', 'gzip1.flat/bar#foo1', 'gzip1.flat/bar#foo2', 'gzip1.flat/foo#bar1', 'gzip1.flat/foo#bar2') with self.Silence(): g = Tar.Tar('tests/tar/gzip1.tar.gz', '#') processed = self.list_files(g.flat_dir) self.assertEqual(set(files), processed)
def test_tar1(self): files = ('gzip1.flat/bar|1|a', 'gzip1.flat/bar|22|bb', 'gzip1.flat/bar|333|ccc', 'gzip1.flat/bar|foo1', 'gzip1.flat/bar|foo2', 'gzip1.flat/foo|bar1', 'gzip1.flat/foo|bar2') with self.Silence(): g = Tar.Tar('tests/tar/gzip1.tar.gz') processed = self.list_files(g.flat_dir) self.assertEqual(set(files), processed)
def test_tar_is_bzip2(self): try: with self.Silence(): b = Tar.Tar('tests/zip/zip1.zip') processed = self.list_files(b.flat_dir) except SystemExit: pass else: self.fail('SystemExit exception expected')
def test_tar_no_separator_exit(self): try: with self.Silence(): b = Tar.Tar('tests/tar/bzip3.tar.bz2', False) processed = self.list_files(b.flat_dir) except SystemExit: pass else: self.fail('SystemExit exception expected')
def test_tar2(self): files = ('tests/tar/gzip2.tar.flat/bar|foo1', 'tests/tar/gzip2.tar.flat/bar|foo2', 'tests/tar/gzip2.tar.flat/baz', 'tests/tar/gzip2.tar.flat/foo|bar1', 'tests/tar/gzip2.tar.flat/foo|bar2') with self.Silence(): g = Tar.Tar('tests/tar/gzip2.tar.gz') processed = self.list_files(g.flat_dir) self.assertEqual(set(files), processed)
def test_tar_symlinks(self): files = ('gzip5.flat/bar1', 'gzip5.flat/bar|bar1', 'gzip5.flat/bar|foo1', 'gzip5.flat/bars', 'gzip5.flat/foo1', 'gzip5.flat/foo|bar1', 'gzip5.flat/foo|foo1', 'gzip5.flat/foos') links = (('gzip5.flat/bar1', 'bar|bar1'), ('gzip5.flat/bar|foo1', 'foo|foo1'), ('gzip5.flat/bars', '/bar/bars'), ('gzip5.flat/foo1', 'foo|foo1'), ('gzip5.flat/foo|bar1', 'bar|bar1'), ('gzip5.flat/foos', '/foo/foos')) with self.Silence(): g = Tar.Tar('tests/tar/gzip5.tar.gz') for (file, target) in links: self.assertEqual(readlink(file), target) processed = self.list_files(g.flat_dir) self.assertEqual(set(files), processed)