diff options
author | Martin Pitt <martinpitt@gnome.org> | 2013-01-18 12:29:30 +0100 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2013-01-18 12:33:32 +0100 |
commit | f36d31481193f1c63abd19b6176bca790621fff1 (patch) | |
tree | fbdafc6657d5d7d86a2301598322358fac1c4b0f /test | |
parent | fd135fe90ce9b9a568468c4ddb21e6d13135e80d (diff) | |
download | gvfs-f36d31481193f1c63abd19b6176bca790621fff1.tar.gz |
tests: Fix tar/zip ArchiveMounter tests
These got accidentally broken when moving the Joliet/RockRidge test to the
static images in test/files/ and updating the expected contents.
Diffstat (limited to 'test')
-rwxr-xr-x | test/gvfs-test | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/gvfs-test b/test/gvfs-test index 093ca6a8..3f2667ab 100755 --- a/test/gvfs-test +++ b/test/gvfs-test @@ -270,12 +270,25 @@ class Programs(GvfsTestCase): self.assertTrue('filesystem::type:' in out, out) class ArchiveMounter(GvfsTestCase): + def add_files(self, add_fn): + '''Add test files to an archive''' + + p = os.path.join(self.workdir, 'hello.txt') + with open(p, 'w') as f: + f.write('hello\n') + add_fn(p, 'hello.txt') + + p = os.path.join(self.workdir, 'bye.txt') + with open(p, 'w') as f: + f.write('bye\n') + add_fn(p, 'stuff/bye.txt') + def test_tar(self): '''archive:// for tar''' tar_path = os.path.join(self.workdir, 'stuff.tar') tf = tarfile.open(tar_path, 'w') - tf.add(__file__, 'gvfs-test.py') + self.add_files(tf.add) tf.close() self.do_test_for_archive(tar_path) @@ -285,7 +298,7 @@ class ArchiveMounter(GvfsTestCase): tar_path = os.path.join(self.workdir, 'stuff.tar.gz') tf = tarfile.open(tar_path, 'w:gz') - tf.add(__file__, 'gvfs-test.py') + self.add_files(tf.add) tf.close() self.do_test_for_archive(tar_path) @@ -295,7 +308,7 @@ class ArchiveMounter(GvfsTestCase): tar_path = os.path.join(self.workdir, 'stuff.tar.bz2') tf = tarfile.open(tar_path, 'w:bz2') - tf.add(__file__, 'gvfs-test.py') + self.add_files(tf.add) tf.close() self.do_test_for_archive(tar_path) @@ -305,7 +318,7 @@ class ArchiveMounter(GvfsTestCase): zip_path = os.path.join(self.workdir, 'stuff.zip') zf = zipfile.ZipFile(zip_path, 'w') - zf.write(__file__, 'gvfs-test.py') + self.add_files(zf.write) zf.close() self.do_test_for_archive(zip_path) |