From b5c38f53a42144f94742590042c8d88a0d3cb12b Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Tue, 18 Jun 2013 12:40:51 +0200 Subject: [PATCH] add extract volume test - not implemented yet (test driven development) --- testing/test_multivol.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/testing/test_multivol.py b/testing/test_multivol.py index 08b1f1e..254f111 100644 --- a/testing/test_multivol.py +++ b/testing/test_multivol.py @@ -157,3 +157,41 @@ class MultivolTest(unittest.TestCase): for key, value in hash.iteritems(): assert os.path.exists(key) assert value == self.md5sum(key) + + def test_volume_extract1(self): + ''' + Create a volume and extract it + ''' + # create the content of the file to compress and hash it + self.create_random_file("big", 50000) + hash = self.md5sum("big") + + # create the tar file with volumes + tarobj = TarFile.open("sample.tar", + mode="w", + max_volume_size=30000, + new_volume_handler=new_volume_handler) + tarobj.add("big") + tarobj.close() + + # check that the tar volumes were correctly created + assert os.path.exists("sample.tar") + assert os.path.exists("sample.tar.1") + assert not os.path.exists("sample.tar.2") + + os.unlink("big") + assert not os.path.exists("big") + + # extract and check output + tarobj = TarFile.open("sample.tar", + mode="w", + max_volume_size=30000, + new_volume_handler=new_volume_handler) + tarobj.extractall() + tarobj.close() + assert os.path.exists("big") + assert hash == self.md5sum("big") + + # TODO: test_volume_extract2 + # TODO: test_volume_extract3 + # TODO: test creating a volume with gnu tar cmd and extract it with our tool \ No newline at end of file -- 1.7.1