Beispiel #1
0
 def test_init_should_accept_fs(self):
     outpath = 'test_init_should_accept_fs'
     if os.path.exists(outpath):
         shutil.rmtree(outpath)
     os.mkdir(outpath)
     unpack(self.olestg, outpath)
     fs = FileSystemStorage(outpath)
     hwp5file = Hwp5File(fs)
     fileheader = hwp5file['FileHeader']
     self.assertTrue(fileheader is not None)
     self.assertEquals((5, 0, 1, 7), fileheader.version)
Beispiel #2
0
    def test_extract_bindata_dir(self):
        base_dir = self.make_base_dir()
        hwp5file = self.hwp5file

        bindata_dir = os.path.join(base_dir, 'bindata')

        self.transform.extract_bindata_dir(hwp5file, bindata_dir)

        bindata_stg = hwp5file['BinData']

        self.assertEqual(set(bindata_stg), set(FileSystemStorage(bindata_dir)))
Beispiel #3
0
    def test_extract_bindata_dir(self):
        base_dir = self.make_base_dir()
        hwp5file = self.hwp5file

        bindata_dir = os.path.join(base_dir, 'bindata')

        from hwp5.hwp5html import extract_bindata_dir
        extract_bindata_dir(hwp5file, bindata_dir)

        bindata_stg = hwp5file['BinData']

        from hwp5.storage.fs import FileSystemStorage
        self.assertEquals(set(bindata_stg),
                          set(FileSystemStorage(bindata_dir)))
Beispiel #4
0
 def test_create_with_nonhwp5_storage(self):
     stg = FileSystemStorage(self.get_fixture_file('nonhwp5stg'))
     self.assertRaises(InvalidHwp5FileError, Hwp5FileBase, stg)
Beispiel #5
0
 def test_create_with_nonhwp5_storage(self):
     from hwp5.errors import InvalidHwp5FileError
     from hwp5.storage.fs import FileSystemStorage
     from hwp5.filestructure import Hwp5FileBase
     stg = FileSystemStorage(self.get_fixture_file('nonhwp5stg'))
     self.assertRaises(InvalidHwp5FileError, Hwp5FileBase, stg)