[TIP] py.test + mock + responses - REST api without rest server for requests

Sylvain Viart sylvain at opensource-expert.com
Thu Nov 3 09:27:59 PDT 2016


Thanks Dan,

Le 02/11/2016 à 19:10, Daniel Bradburn a écrit :
>
> Hi Sylvain, perhaps the responses library might be of use to you for
> mocking the requests library
>
> https://pypi.python.org/pypi/responses
>

I finally followed your hint, quite simple, I recorded server
expectation, and served it back in my test.

https://github.com/opensource-expert/powerdns-shell-wrapper/blob/dev-override-cmd-line/test/test_pdns_zone.py#L126

I added functional testing with bats
<https://github.com/sstephenson/bats/>, which is a bash testing
framework (a bit slow), I did not setup a testing server, and used local
production server…

Have a nice day,
Sylvain.

-- 
Sylvain Viart - DevOps système linux - freelance developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20161103/0c4e4ea9/attachment.htm>


More information about the testing-in-python mailing list