71 lines
2.7 KiB
Python
71 lines
2.7 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# This file is part of facho. The COPYRIGHT file at the top level of
|
|
# this repository contains the full copyright notices and license terms.
|
|
# from datetime import datetime
|
|
|
|
import pytest
|
|
from facho.fe import form_xml
|
|
|
|
import helpers
|
|
|
|
|
|
def test_xml_with_required_elements():
|
|
doc = form_xml.AttachedDocument(id='123')
|
|
xml = doc.toFachoXML()
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:UBLVersionID') == 'UBL 2.1'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:CustomizationID') == 'Documentos adjuntos'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:ProfileID') == 'Factura Electrónica de Venta'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:ProfileExecutionID') == '1'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:ID') == '123'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:IssueDate') == '2024-12-07'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:IssueTime') == '12:16:07-05:00'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:DocumentType'
|
|
) == 'Contenedor de Factura Electrónica'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cbc:ParentDocumentID'
|
|
) == 'FE60247'
|
|
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:SenderParty/cac:PartyTaxScheme/cbc:RegistrationName'
|
|
) == 'CASCOS MEDELLIN'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:SenderParty/cac:PartyTaxScheme/cbc:CompanyID'
|
|
) == '900795506'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:SenderParty/cac:PartyTaxScheme/cbc:TaxLevelCode'
|
|
) == 'R-99-PN'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:SenderParty/cac:PartyTaxScheme/cac:TaxScheme/cbc:ID'
|
|
) == '01'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:SenderParty/cac:PartyTaxScheme/cac:TaxScheme/cbc:Name'
|
|
) == 'IVA'
|
|
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:ReceiverParty/cac:PartyTaxScheme/cbc:RegistrationName'
|
|
) == 'CASCOS MEDELLIN'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:ReceiverParty/cac:PartyTaxScheme/cbc:CompanyID'
|
|
) == '900795506'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:ReceiverParty/cac:PartyTaxScheme/cbc:TaxLevelCode'
|
|
) == 'R-99-PN'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:ReceiverParty/cac:PartyTaxScheme/cac:TaxScheme/cbc:ID'
|
|
) == '01'
|
|
assert xml.get_element_text(
|
|
'/atd:AttachedDocument/cac:ReceiverParty/cac:PartyTaxScheme/cac:TaxScheme/cbc:Name'
|
|
) == 'IVA'
|
|
|
|
# with open("output.xml", "w") as fh:
|
|
# fh.write(xml.tostring())
|