示例#1
0
 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")
示例#2
0
 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)
示例#3
0
 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()
示例#4
0
 def test_constructor(self):
     fm = filemanager.FileManager()
     self.assertTrue(fm.directory, 'filemanager has no directory object')