xml erzeugen bei 40%

This commit is contained in:
Frederik Jaeckel 2022-10-17 17:20:25 +02:00
parent baf871e506
commit 265e38c24f
12 changed files with 357 additions and 1 deletions

38
tests/test_edocument.py Normal file
View file

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# This file is part of the cashbook-module from m-ds for Tryton.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
from trytond.modules.edocument_uncefact.tests.test_edocument_uncefact import get_invoice
from unittest.mock import Mock, MagicMock
class EdocTestCase(ModuleTestCase):
'Test e-rechnung module'
module = 'edocument_xrechnung'
@with_transaction()
def test_xrechn_export_xml(self):
""" run export
"""
pool = Pool()
Template = pool.get('edocument.xrechnung.invoice')
Address = pool.get('party.address')
Identifier = pool.get('party.identifier')
invoice = get_invoice()
invoice.party.get_xrechnung_route_id = Mock(return_value='xrechn-route-id-123')
invoice.identifiers = [
Mock(spec=Identifier,
type='edoc_route_id',
code='xrechn-route-id-123')
]
template = Template(invoice)
invoice_string = template.render('XRechnung-2.2')
with open('xrechnung-test.xml', 'wt') as fhdl:
fhdl.write(invoice_string.decode('utf8'))
# end EdocTestCase