'Test the zipfile implementation.'

def testZipFileWithMultipleFiles(self):

    compressions = [zipfile.ZIP_STORED, zipfile.ZIP_DEFLATED]
    for compression in compressions:
        outfd = StringIO.StringIO()
        infd1 = StringIO.StringIO('this    is    a    test    string')
        infd2 = StringIO.StringIO('this    is    another    test    string')
        with utils.StreamingZipWriter(outfd, compression=compression) as writer:
            writer.WriteFromFD(infd1, 'test1.txt')
            writer.WriteFromFD(infd2, 'test2.txt')
        test_zip = zipfile.ZipFile(outfd, 'r')
        test_zip.testzip()
        self.assertEqual(sorted(test_zip.namelist()), ['test1.txt', 'test2.txt'])
        self.assertEqual(test_zip.read('test1.txt'), infd1.getvalue())
        self.assertEqual(sorted(test_zip.namelist()), ['test1.txt', 'test2.txt'])
        self.assertEqual(test_zip.read('test2.txt'), infd2.getvalue())
