def test_to_zip_manifest(self): fm = filemanager.FileManager() fm.register('addfirst', 'SilentHill') fm.register('addsecond', 'SinCity') fm.register('mimetype', 'MaxPayne') zippo = ZipMock() fm._tozip(zippo) self.assertEqual(zippo.writtenfiles[0], 'mimetype', "file 'mimetype' SHOULD be the first written file")
def test_save(self): SAVENAME = getdatafile('specs.save.odt') fm = filemanager.FileManager(SPECFILE) # to use save you have to register at least the mimetype file mimetype = fm.get_bytes('mimetype') fm.register('mimetype', mimetype) fm.save(SAVENAME, backup=False) self.assertTrue(check_zipfile_for_oasis_validity(SAVENAME, mimetype)) os.remove(SAVENAME)
def copy_file(from_, to_): fm = filemanager.FileManager(from_) zf = zipfile.ZipFile(to_, 'w', compression=zipfile.ZIP_DEFLATED) fm._copy_zip_to(zf) zf.close()
def test_constructor(self): fm = filemanager.FileManager() self.assertTrue(fm.directory, 'filemanager has no directory object')