oc-facho/tests/test_client_dian.py
bit4bit@riseup.net 10f021d0fd se extrae libreria de etrivial
FossilOrigin-Name: 5cae2a8c5985850e97b3d416ba14a90c66e2c05e3a4f9c28fdbc767d6c29748f
2020-05-23 18:56:22 +00:00

45 lines
1.1 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 facho.fe.client import dian
from facho import facho
import pytest
from datetime import datetime
class FakeDianClient(dian.DianClient):
def __init__(self, username, password, resp):
super().__init__(username, password)
self.response = resp
def _open(self, service):
return None
def _close(self, conn):
pass
def _remote_service(self, conn, service):
def fake_remote(**kw):
return self.response
return fake_remote
def test_sopa_consultaresolucionesfacturacion():
expected_resp = {
'CodigoOperacion': 'OK',
'DescripcionOperacion': '',
'IdentificadorOperacion': '',
'RangoFacturacion': []
}
client_dian = FakeDianClient('user', 'pass', expected_resp)
resp = client_dian.request(dian.ConsultaResolucionesFacturacionPeticion(
'860046645', '800037646', '13a6a789-47ca-4728-adb8-372fca76e692'
))
assert resp.CodigoOperacion == 'OK'