5 changed files with 87 additions and 55 deletions
-
53pytrustnfe/servicos/Comunicacao.py
-
14pytrustnfe/servicos/NfeConsultaCadastro.py
-
27pytrustnfe/test/test_comunicacao.py
-
33pytrustnfe/test/test_consulta_cadastro.py
-
15pytrustnfe/utils.py
@ -0,0 +1,33 @@ |
|||
#coding=utf-8 |
|||
''' |
|||
Created on 22/06/2015 |
|||
|
|||
@author: danimar |
|||
''' |
|||
import unittest |
|||
from pytrustnfe.servicos.NfeConsultaCadastro import NfeConsultaCadastro |
|||
from pytrustnfe.xml.DynamicXml import DynamicXml |
|||
|
|||
|
|||
class Test(unittest.TestCase): |
|||
|
|||
def setUp(self): |
|||
unittest.TestCase.setUp(self) |
|||
c = DynamicXml('ConsCad') |
|||
c(xmlns="http://www.portalfiscal.inf.br/nfe", versao="2.00") |
|||
c.infCons.xServ = 'CONS-CAD' |
|||
c.infCons.UF = 'SC' |
|||
c.infCons.CNPJ = '82951310000156' |
|||
self.objeto_consulta = c |
|||
|
|||
def test_consulta_cadastro(self): |
|||
try: |
|||
dir_pfx = '/home/danimar/projetos/isotelha.pfx' #Hack |
|||
|
|||
com = NfeConsultaCadastro(dir_pfx, 'iso@#telha') |
|||
xml, objeto = com.consultar_cadastro(self.objeto_consulta, 'SC') |
|||
|
|||
print xml |
|||
print objeto |
|||
except Exception as e: |
|||
print(str(e)) |
|||
@ -0,0 +1,15 @@ |
|||
# coding=utf-8 |
|||
''' |
|||
Created on 22/06/2015 |
|||
|
|||
@author: danimar |
|||
''' |
|||
from datetime import date, datetime |
|||
|
|||
def date_tostring(data): |
|||
assert isinstance(data, date), "Objeto date requerido" |
|||
return data.strftime("%d-%m-%y") |
|||
|
|||
def datetime_tostring(data): |
|||
assert isinstance(data, datetime), "Objeto datetime requerido" |
|||
return data.strftime("%d-%m-%y %H:%M:%S") |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue