From bf662a4dfc770ac6221d3d0164d7b5b4c5f9303e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marinho=20Brand=C3=A3o?= Date: Sun, 17 Jan 2010 23:05:01 -0200 Subject: [PATCH] Trabalhando no servidor de SOAP fake, agora sobre Tornado --- run_fake_soap_server.py | 31 ++++++++++++------------------- tests/03-processamento-03-assinatura.txt | 11 ++++++++++- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/run_fake_soap_server.py b/run_fake_soap_server.py index b93ac58..77a3ad2 100644 --- a/run_fake_soap_server.py +++ b/run_fake_soap_server.py @@ -4,27 +4,20 @@ from soaplib.service import soapmethod class ServidorNFEFalso(SimpleWSGISoapApp): from soaplib.serializers.primitive import String, Integer, Array, Null - @soapmethod(_returns=Null) - def finalizar(self): - import sys - sys.exit(0) - - @soapmethod(_returns=String) - def ping(self): - return 'eu estou aqui' + @soapmethod(String, Integer, _returns=String) + def ping(self, palavra, vezes): + return ','.join([palavra for i in range(vezes)]) if __name__ == '__main__': - porta = 8081 + porta = 8080 # Via Tornado - #import tornado.httpserver - #import tornado.ioloop - #http_server = tornado.httpserver.HTTPServer(ServidorNFEFalso()) - #http_server.listen(porta) - #tornado.ioloop.IOLoop.instance().start() - - # Via CherryPy - from cherrypy.wsgiserver import CherryPyWSGIServer - server = CherryPyWSGIServer(('localhost', porta), ServidorNFEFalso()) - server.start() + import tornado.wsgi + import tornado.httpserver + import tornado.ioloop + application = ServidorNFEFalso() + container = tornado.wsgi.WSGIContainer(application) + http_server = tornado.httpserver.HTTPServer(container) + http_server.listen(porta) + tornado.ioloop.IOLoop.instance().start() diff --git a/tests/03-processamento-03-assinatura.txt b/tests/03-processamento-03-assinatura.txt index c619344..c17ac1f 100644 --- a/tests/03-processamento-03-assinatura.txt +++ b/tests/03-processamento-03-assinatura.txt @@ -22,7 +22,7 @@ processo e a capture. A assinatura deve ser feita em quatro tipos diferentes de origem do XML: -- Arquivos +- Arquivo >>> assinatura.assinar_arquivo('tests/saida/nfe-1.xml') True @@ -48,4 +48,13 @@ A assinatura deve ser feita em quatro tipos diferentes de origem do XML: Verificando assinatura ---------------------- +TODO + +Da mesma forma que na assinatura, a verificacao deve suportar os seguintes +formatos de dados: + +- Arquivos +- String de XML +- Instancias do PyNFe +- Instancia de lxml.etree