diff --git a/.travis.yml b/.travis.yml index e157592..fb703b0 100644 --- a/.travis.yml +++ b/.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: diff --git a/pytrustnfe/HttpClient.py b/pytrustnfe/HttpClient.py index 52ae183..0ac3407 100644 --- a/pytrustnfe/HttpClient.py +++ b/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: diff --git a/pytrustnfe/servicos/Comunicacao.py b/pytrustnfe/servicos/Comunicacao.py index c46a3b5..246c724 100644 --- a/pytrustnfe/servicos/Comunicacao.py +++ b/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 diff --git a/pytrustnfe/test/test_comunicacao.py b/pytrustnfe/test/test_comunicacao.py index 6c0876f..0a9b4e2 100644 --- a/pytrustnfe/test/test_comunicacao.py +++ b/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() diff --git a/requirements.txt b/requirements.txt index edacdc8..3961f03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ +PyOpenSSL nose -mock \ No newline at end of file +mock +coveralls \ No newline at end of file