def test_0001_letter_template(self): data = { "company": { "companyName": "test", "companyNumber": "1" }, "transaction": { "shareClass": "x", "amount": 100, "consideration": 1, "effectiveDateString": "16th March 2012" }, "transferors": [{"name": "Guy", "address": "house"}], "transferees": [{"name": "Mitch", "address": "house"}], } render_odt('transfer', data, subdir='goodcompanies')
def render(): try: data = request.get_json(force=True) form_name = os.path.basename(data['formName']) values = data['values'] subdir = None if data.get('goodCompaniesTemplate'): subdir = 'goodcompanies' result = render_odt(form_name, values, subdir=subdir) filename = os.path.basename(values.get('filename', data['formName'])) file_type = values.get('fileType', 'odt') if file_type != 'odt' and EXTENSIONS.get(file_type): result = convert_type_service(result, file_type) return send_file(BytesIO(result), attachment_filename=filename + EXTENSIONS[file_type], as_attachment=True, mimetype=MIMETYPES[file_type]) except Exception as e: print(e) raise InvalidUsage(e.message, status_code=500)
def test_0011_demand(self): with open('fixtures/DR01.json') as data: render_odt('DR01: Letter of Demand - Debtor', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0010_trust_balance(self): for d in xrange(1, 3): with open('fixtures/CV10.%d.json' % d) as data: render_odt('CV10: Trust Account Statement', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0009_financier(self): with open('fixtures/CV07.json') as data: render_odt('CV07: Letter to Financier Enclosing Originals', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0008_vendors_settlement(self): with open('fixtures/CV06.json') as data: render_odt('CV06: Vendors Settlement Letter', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0007_mortgage(self): with open('fixtures/CV05.json') as data: render_odt('CV05: Mortgage Discharge Request', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0006_settlment_undertakings_letter_vendor(self): with open('fixtures/CV04.json') as data: render_odt('CV04: Settlement Undertakings Letter - Acting for Vendor', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0004_letter_of_engagment_conveyancing(self): with open('fixtures/CV01.json') as data: render_odt('CV01: Letter of Engagement - Conveyancing', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0003_file_closing_letter(self): with open('fixtures/G03.json') as data: render_odt('G03: File Closing Letter', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0002_letter_of_engagement(self): with open('fixtures/G02.json') as data: render_odt('G02: Letter of Engagement', dict(json.loads(data.read()).items() + [("mappings", mappings)]))
def test_0001_letter_template(self): with open('fixtures/G01.json') as data: render_odt('G01: Letter Template', dict(json.loads(data.read()).items() + [("mappings", mappings)]))