se adiciona Ajuste Reemplazar y Eliminar
FossilOrigin-Name: b488d606e28c44a581d7a387d33f08442d53d613149fd19b264e28a6b94a8951
This commit is contained in:
@@ -103,6 +103,7 @@ def test_facho_xml_fragment():
|
||||
invoice.set_element('/Invoice/Id', 1)
|
||||
assert xml.tostring() == '<root><Invoice><Id>1</Id></Invoice></root>'
|
||||
|
||||
|
||||
def test_facho_xml_fragments():
|
||||
xml = facho.FachoXML('Invoice')
|
||||
|
||||
@@ -129,6 +130,13 @@ def test_facho_xml_nested_fragments():
|
||||
|
||||
assert xml.tostring() == '<Invoice><Party><Name>test</Name><Address><Line>line 1</Line></Address><LastName>test</LastName></Party></Invoice>'
|
||||
|
||||
def test_facho_xml_get_element_text_of_fragment():
|
||||
xml = facho.FachoXML('root')
|
||||
invoice = xml.fragment('/root/Invoice')
|
||||
invoice.set_element('/Invoice/Id', 1)
|
||||
|
||||
assert invoice.get_element_text('/Invoice/Id') == '1'
|
||||
|
||||
def test_facho_xml_get_element_text():
|
||||
xml = facho.FachoXML('Invoice')
|
||||
xml.set_element('/Invoice/ID', 'ABC123')
|
||||
@@ -171,6 +179,11 @@ def test_facho_xml_fragment_relative():
|
||||
invoice.set_element('./Id', 1)
|
||||
assert xml.tostring() == '<root><Invoice><Id>1</Id></Invoice></root>'
|
||||
|
||||
def test_facho_xml_get_element_fragment_relative():
|
||||
xml = facho.FachoXML('root')
|
||||
invoice = xml.fragment('./Invoice')
|
||||
invoice.set_element('./Id', 1)
|
||||
assert invoice.get_element_text('./Id') == '1'
|
||||
|
||||
def test_facho_xml_replacement_for():
|
||||
xml = facho.FachoXML('root')
|
||||
@@ -371,6 +384,14 @@ def test_facho_xml_query_element_text_or_attribute():
|
||||
assert xml.get_element_text_or_attribute('/root/A') == 'contenido'
|
||||
assert xml.get_element_text_or_attribute('/root/A/@clave') == 'valor'
|
||||
|
||||
def test_facho_xml_query_element_text_or_attribute_from_fragment():
|
||||
xml = facho.FachoXML('root')
|
||||
|
||||
invoice = xml.fragment('/root/Invoice')
|
||||
invoice.set_element('./A', 'contenido')
|
||||
|
||||
assert invoice.get_element_text_or_attribute('/Invoice/A') == 'contenido'
|
||||
|
||||
def test_facho_xml_build_xml_absolute():
|
||||
xml = facho.FachoXML('root')
|
||||
|
||||
@@ -384,3 +405,13 @@ def test_facho_xml_build_xml_absolute_namespace():
|
||||
|
||||
xpath = xml.xpath_from_root('/A')
|
||||
assert xpath == '/fe:root/A'
|
||||
|
||||
|
||||
def test_facho_xml_build_xml_absolute_namespace_from_fragment():
|
||||
xml = facho.FachoXML('{%s}root' % ('http://www.dian.gov.co/contratos/facturaelectronica/v1'),
|
||||
nsmap={'fe': 'http://www.dian.gov.co/contratos/facturaelectronica/v1'})
|
||||
invoice = xml.fragment('/root/Invoice')
|
||||
|
||||
xpath = invoice.xpath_from_root('/A')
|
||||
assert xpath == '/fe:root/Invoice/A'
|
||||
|
||||
|
||||
@@ -239,3 +239,47 @@ def test_nomina_xmlsign(monkeypatch):
|
||||
print(xml.tostring())
|
||||
elem = xml.get_element('/fe:NominaIndividual/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/ds:Signature')
|
||||
assert elem is not None
|
||||
|
||||
|
||||
def atest_nomina_ajuste_reemplazar():
|
||||
nomina = fe.nomina.DIANNominaIndividualDeAjuste.Reemplazar()
|
||||
|
||||
xml = nomina.toFachoXML()
|
||||
print(xml)
|
||||
assert False
|
||||
|
||||
|
||||
def test_adicionar_reemplazar_devengado_comprobante_total():
|
||||
nomina = fe.nomina.DIANNominaIndividualDeAjuste.Reemplazar()
|
||||
|
||||
nomina.adicionar_devengado(fe.nomina.DevengadoBasico(
|
||||
dias_trabajados = 60,
|
||||
sueldo_trabajado = fe.nomina.Amount(2_000_000)
|
||||
))
|
||||
|
||||
nomina.adicionar_deduccion(fe.nomina.DeduccionSalud(
|
||||
porcentaje = fe.nomina.Amount(19),
|
||||
deduccion = fe.nomina.Amount(1_000_000)
|
||||
))
|
||||
|
||||
xml = nomina.toFachoXML()
|
||||
|
||||
assert xml.get_element_text('/fe:NominaIndividualDeAjuste/Reemplazar/ComprobanteTotal') == '1000000.00'
|
||||
|
||||
|
||||
def test_adicionar_eliminar_devengado_comprobante_total():
|
||||
nomina = fe.nomina.DIANNominaIndividualDeAjuste.Eliminar()
|
||||
|
||||
nomina.adicionar_devengado(fe.nomina.DevengadoBasico(
|
||||
dias_trabajados = 60,
|
||||
sueldo_trabajado = fe.nomina.Amount(2_000_000)
|
||||
))
|
||||
|
||||
nomina.adicionar_deduccion(fe.nomina.DeduccionSalud(
|
||||
porcentaje = fe.nomina.Amount(19),
|
||||
deduccion = fe.nomina.Amount(1_000_000)
|
||||
))
|
||||
|
||||
xml = nomina.toFachoXML()
|
||||
|
||||
assert xml.get_element_text('/fe:NominaIndividualDeAjuste/Eliminar/ComprobanteTotal') == '1000000.00'
|
||||
|
||||
Reference in New Issue
Block a user