Testing Spyne application

2019-06-12 11:30发布

What is the best practice to test Spyne application. Does it have test client like Django or Flask. I dont like idea to start wsgi server to test my application.

Here is my flask+spyne example https://github.com/satyrius/flask-spyne-example

1条回答
Lonely孤独者°
2楼-- · 2019-06-12 11:48

For testing, we have the NullServer: http://spyne.io/docs/2.10/reference/server.html?highlight=nullserver#spyne.server.null.NullServer

It implements something close to the suds interface. Here's an example:

>>> app = Application(...)
>>> null = NullServer(app, ostr=False)
>>> print list(null.service.say_hello('Dave', 5)) 
[u'Hello, Dave', u'Hello, Dave', u'Hello, Dave', u'Hello, Dave', u'Hello, Dave']

Here's a fully working example: https://gist.github.com/7014099

查看更多
登录 后发表回答