"""Utilities to test PDF generation.""" from oto import response from salessheets import config from salessheets.constants import field_const def response_from_create_pdf(product_id, data_from_db): """Emulate create pdf response.""" body_template_file = '{dir}/{id}.html'.format( dir=config.PDF_RENDERING_DIR, id=product_id) header_template_file = '{dir}/{id}_header.html'.format( dir=config.PDF_RENDERING_DIR, id=product_id) rendered_pdf_file = '{dir}/{id}.pdf'.format( dir=config.PDF_RENDERING_DIR, id=product_id) return response.Response({ field_const.GENERATED_FILES: [body_template_file, header_template_file, rendered_pdf_file], field_const.DATA_FOR_RENDERING: response.Response(data_from_db)})