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