From c10115652a795d0c7971ec9b03c4c58742063ddf Mon Sep 17 00:00:00 2001 From: Jesse Jaggars Date: Mon, 5 Mar 2012 10:30:59 -0600 Subject: 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 --- tests/archive_tests.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'tests/archive_tests.py') 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() -- cgit