Browse Source

Corrigindo travis

tags/0.1.5
Danimar Ribeiro 11 years ago
parent
commit
17863782d8
  1. 5
      .travis.yml
  2. 1
      pytrustnfe/HttpClient.py
  3. 5
      pytrustnfe/servicos/Comunicacao.py
  4. 15
      pytrustnfe/test/test_comunicacao.py
  5. 4
      requirements.txt

5
.travis.yml

@ -1,13 +1,12 @@
language: python
python:
- "2.7"
virtual_env:
system_site_packages: true
install:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install lxml --upgrade
- pip install http://xmlsoft.org/sources/python/libxml2-python-2.6.21.tar.gz
- pip install PyXmlSec --allow-external PyXMLSec --allow-insecure PyXMLSec
- pip install coveralls
script:
coverage run --source=pytrustnfe setup.py nosetests
before_install:

1
pytrustnfe/HttpClient.py

@ -29,6 +29,7 @@ class HttpClient(object):
response = conexao.getresponse()
if response.status == '200':
return response.read()
return response.read()
except Exception as e:
print str(e)
finally:

5
pytrustnfe/servicos/Comunicacao.py

@ -42,10 +42,9 @@ class Comunicacao(object):
def envio_nfe(self):
chave, certificado = self._preparar_temp_pem()
c = HttpClient('cad.svrs.rs.gov.br', chave, certificado)
c = HttpClient('cad.sefazrs.rs.gov.br', chave, certificado)
xml_retorno = c.post_xml('/ws/cadconsultacadastro/cadconsultacadastro2.asmx', '')
xml_retorno = c.post_xml('/ws/cadconsultacadastro/cadconsultacadastro2.asmx', '')
obj = objectify.fromstring(xml_retorno)
return xml_retorno, obj

15
pytrustnfe/test/test_comunicacao.py

@ -16,11 +16,22 @@ class test_comunicacao(unittest.TestCase):
caminho = os.path.dirname(__file__)
#Teste temporario
def test_envio_without_mock(self):
try:
dir_pfx = '/home/danimar/Desktop/isotelha.pfx' #Hack
com = Comunicacao(dir_pfx, 'iso@#telha')
xml, objeto = com.envio_nfe()
print xml
print objeto
except Exception as e:
print(str(e))
def test_envio_nfe(self):
dir_pfx = os.path.join(self.caminho, 'teste.pfx')
#dir_pfx = '/home/danimar/Desktop/INFOGER.pfx' #Hack
with mock.patch('pytrustnfe.HttpClient.HTTPSConnection') as HttpsConnection:
conn = HttpsConnection.return_value
retorno = mock.MagicMock()

4
requirements.txt

@ -1,2 +1,4 @@
PyOpenSSL
nose
mock
mock
coveralls
Loading…
Cancel
Save