Browse Source

flask8

pull/262/head
Gabriela Cavalcante da Silva 6 years ago
parent
commit
9574a48d8d
  1. 6
      .flake8
  2. 2
      nfe.py
  3. 2
      pytrustnfe/nfse/imperial/__init__.py
  4. 20
      tests/test_nfse_paulistana.py

6
.flake8

@ -0,0 +1,6 @@
[flake8]
ignore = E203, E266, E501, W503, F403, E402, E265, E231
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = .git,__pycache__,api/specs/,migrations/

2
nfe.py

@ -1,9 +1,7 @@
import xml.dom.minidom import xml.dom.minidom
import os import os
import mock
from pytrustnfe.nfse.natal import recepcionar_lote_rps from pytrustnfe.nfse.natal import recepcionar_lote_rps
from pytrustnfe.certificado import Certificado from pytrustnfe.certificado import Certificado
from pytrustnfe.nfse.assinatura import Assinatura
rps_list = [ rps_list = [

2
pytrustnfe/nfse/imperial/__init__.py

@ -5,9 +5,7 @@
import os import os
import requests import requests
from lxml import etree from lxml import etree
from requests import Session
from zeep import Client from zeep import Client
from zeep.transports import Transport
from pytrustnfe.xml import render_xml, sanitize_response from pytrustnfe.xml import render_xml, sanitize_response

20
tests/test_nfse_paulistana.py

@ -6,8 +6,6 @@ import unittest
from pytrustnfe.certificado import Certificado from pytrustnfe.certificado import Certificado
from pytrustnfe.nfse.paulistana import envio_lote_rps from pytrustnfe.nfse.paulistana import envio_lote_rps
from pytrustnfe.nfse.paulistana import cancelamento_nfe from pytrustnfe.nfse.paulistana import cancelamento_nfe
from pytrustnfe.nfse.assinatura import Assinatura
from pytrustnfe.nfse.paulistana import sign_tag
class test_nfse_paulistana(unittest.TestCase): class test_nfse_paulistana(unittest.TestCase):
@ -57,7 +55,8 @@ class test_nfse_paulistana(unittest.TestCase):
nfse = self._get_nfse() nfse = self._get_nfse()
path = os.path.join(os.path.dirname(__file__), "XMLs") path = os.path.join(os.path.dirname(__file__), "XMLs")
xml_return = open(os.path.join(path, "paulistana_resultado.xml"), "r").read()
xml_return = open(os.path.join(
path, "paulistana_resultado.xml"), "r").read()
with mock.patch( with mock.patch(
"pytrustnfe.nfse.paulistana.get_authenticated_client" "pytrustnfe.nfse.paulistana.get_authenticated_client"
@ -70,8 +69,10 @@ class test_nfse_paulistana(unittest.TestCase):
self.assertEqual(retorno["received_xml"], xml_return) self.assertEqual(retorno["received_xml"], xml_return)
self.assertEqual(retorno["object"].Cabecalho.Sucesso, True) self.assertEqual(retorno["object"].Cabecalho.Sucesso, True)
self.assertEqual(retorno["object"].ChaveNFeRPS.ChaveNFe.NumeroNFe, 446)
self.assertEqual(retorno["object"].ChaveNFeRPS.ChaveRPS.NumeroRPS, 6)
self.assertEqual(
retorno["object"].ChaveNFeRPS.ChaveNFe.NumeroNFe, 446)
self.assertEqual(
retorno["object"].ChaveNFeRPS.ChaveRPS.NumeroRPS, 6)
def test_nfse_signature(self): def test_nfse_signature(self):
pfx_source = open(os.path.join(self.caminho, "teste.pfx"), "rb").read() pfx_source = open(os.path.join(self.caminho, "teste.pfx"), "rb").read()
@ -79,7 +80,8 @@ class test_nfse_paulistana(unittest.TestCase):
nfse = self._get_nfse() nfse = self._get_nfse()
path = os.path.join(os.path.dirname(__file__), "XMLs") path = os.path.join(os.path.dirname(__file__), "XMLs")
xml_sent = open(os.path.join(path, "paulistana_signature.xml"), "r").read()
xml_sent = open(os.path.join(
path, "paulistana_signature.xml"), "r").read()
with mock.patch( with mock.patch(
"pytrustnfe.nfse.paulistana.get_authenticated_client" "pytrustnfe.nfse.paulistana.get_authenticated_client"
@ -106,7 +108,8 @@ class test_nfse_paulistana(unittest.TestCase):
cancelamento = self._get_cancelamento() cancelamento = self._get_cancelamento()
path = os.path.join(os.path.dirname(__file__), "XMLs") path = os.path.join(os.path.dirname(__file__), "XMLs")
xml_return = open(os.path.join(path, "paulistana_canc_ok.xml"), "r").read()
xml_return = open(os.path.join(
path, "paulistana_canc_ok.xml"), "r").read()
with mock.patch( with mock.patch(
"pytrustnfe.nfse.paulistana.get_authenticated_client" "pytrustnfe.nfse.paulistana.get_authenticated_client"
@ -126,7 +129,8 @@ class test_nfse_paulistana(unittest.TestCase):
cancelamento = self._get_cancelamento() cancelamento = self._get_cancelamento()
path = os.path.join(os.path.dirname(__file__), "XMLs") path = os.path.join(os.path.dirname(__file__), "XMLs")
xml_return = open(os.path.join(path, "paulistana_canc_errado.xml"), "r").read()
xml_return = open(os.path.join(
path, "paulistana_canc_errado.xml"), "r").read()
with mock.patch( with mock.patch(
"pytrustnfe.nfse.paulistana.get_authenticated_client" "pytrustnfe.nfse.paulistana.get_authenticated_client"

Loading…
Cancel
Save