Ejemplo n.º 1
0
 def test_get_pdf_path_2(self):
     document_file_info = DocumentFileInfo(1)
     document_file_info.filetype = 'tif'
     document_file_info.document_id = 1
     file_info = DocumentFileInfo(3)
     file_info.filetype = 'gif'
     file_info.document_id = 1
     self.document_file_info_dao.get_by_id.return_value = document_file_info
     pdf_path = self.document_file_manager.get_generated_file_path(
         file_info, DOCUMENT_PDF)
     self.assertTrue(
         "filestorage/archive/1000/tif/pdf/00000001.pdf" in pdf_path)
Ejemplo n.º 2
0
    def append_file_info(self, id, filetype, resolution, page, document_id):

        info = DocumentFileInfo(id)
        info.filetype = filetype
        info.resolution = resolution
        info.page = page
        info.document_id = document_id
        self.document_file_infos.append(info)
Ejemplo n.º 3
0
 def add_document_file(self, document, file):
     file_info = DocumentFileInfo(len(self.file_infos[document]) + 1)
     filetype, res = self.file_format_service.get_format_and_resolution(
         file)
     file_info.filetype = filetype
     file_info.resolution = res
     file_info.document_id = document.id
     self.file_infos[document].append(file_info)
Ejemplo n.º 4
0
 def test_get_pdf_path_3(self):
     document_file_info = DocumentFileInfo(8)
     document_file_info.filetype = 'pdf'
     document_file_info.document_id = 8
     self.document_file_info_dao.get_by_id.return_value = document_file_info
     pdf_path = self.document_file_manager.get_generated_file_path(
         document_file_info, DOCUMENT_PDF)
     self.assertTrue("filestorage/docs/pdf/pdf/00000008.pdf" in pdf_path)
Ejemplo n.º 5
0
 def test_get_pdf_path(self):
     file_info = DocumentFileInfo(1)
     file_info.filetype = 'tif'
     file_info.document_id = 1
     pdf_path = self.document_file_manager.get_generated_file_path(
         file_info, DOCUMENT_PDF)
     self.assertTrue(
         "filestorage/archive/1000/tif/pdf/00000001.pdf" in pdf_path)
Ejemplo n.º 6
0
 def __init__(self):
     config = Config(os.path.join(get_testfiles_dir(), "testconfig.xml"))
     self.file_format_service = FileFormatService(config)
     self.file_infos = {}
     document = Document(1)
     self.file_infos[document] = []
     file_info = DocumentFileInfo(1)
     file_info.document_id = 1
     file_info.filetype = "tif"
     file_info.resolution = 300
     self.file_infos[document].append(file_info)