diff options
author | Jesse Jaggars <jjaggars@redhat.com> | 2012-03-05 10:30:59 -0600 |
---|---|---|
committer | Jesse Jaggars <jjaggars@redhat.com> | 2012-03-05 10:30:59 -0600 |
commit | c10115652a795d0c7971ec9b03c4c58742063ddf (patch) | |
tree | 4c14fa591b807350f6db6c7da10f1430049602f5 /tests/archive_tests.py | |
parent | 83c6e09756bd228dc76e7a84646de5a9f5b5e694 (diff) | |
download | sos-c10115652a795d0c7971ec9b03c4c58742063ddf.tar.gz |
Refactoring PackageManagers and Archives
Pulled up PackageManager implementation to simplify subclass responsibilities
Moved compress method to Archive classes
Re-organized utilities.py
Added tests to exercise more utilities methods
Diffstat (limited to 'tests/archive_tests.py')
-rw-r--r-- | tests/archive_tests.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/archive_tests.py b/tests/archive_tests.py index f982be0a..8a542f73 100644 --- a/tests/archive_tests.py +++ b/tests/archive_tests.py @@ -66,13 +66,27 @@ class ZipFileArchiveTest(unittest.TestCase): afp = self.zf.open_file('tests/string_test.txt') self.assertEquals('this is my new content', afp.read()) + def test_make_link(self): + self.zf.add_file('tests/ziptest') + self.zf.add_link('tests/ziptest', 'link_name') + + self.zf.close() + try: + self.check_for_file('test/link_name') + self.fail("link should not exist") + except KeyError: + pass + + def test_compress(self): + self.assertEquals(self.zf.compress("zip"), self.zf.name()) + class TarFileArchiveTest(unittest.TestCase): def setUp(self): self.tf = TarFileArchive('test') def tearDown(self): - os.unlink('test.tar') + os.unlink(self.tf.name()) def check_for_file(self, filename): rtf = tarfile.open('test.tar') @@ -126,5 +140,15 @@ class TarFileArchiveTest(unittest.TestCase): afp = self.tf.open_file('tests/string_test.txt') self.assertEquals('this is my new content', afp.read()) + def test_make_link(self): + self.tf.add_file('tests/ziptest') + self.tf.add_link('tests/ziptest', 'link_name') + + self.tf.close() + self.check_for_file('test/link_name') + + def test_compress(self): + name = self.tf.compress("gzip") + if __name__ == "__main__": unittest.main() |