Il 17/03/2015 20:45, Frances Hocutt ha scritto:
I'm working on cleaning up the code[1] for GrantsBot[2] and generally getting it into better and more robust shape. I've started writing basic unit tests to assist in the refactoring process. Since it interacts so heavily with the MediaWiki API, however, this isn't a straightforward process, and it's even more complicated because I'll be rewriting it to use a different client library (so any mocks/stubs I include will need to be rewritten). Does anyone have thoughts on the best strategy for this, or, more generally, pointers to good resources for writing unit tests for API clients?
-Frances
[1] dev branch: https://github.com/fhocutt/grantsbot/tree/dev [2] a bot run by Community Resources to maintain the IdeaLab on MetaWiki: https://meta.wikimedia.org/wiki/User:GrantsBot
If you're using Pywikibot, you may want to have a look at its extensive unit tests :)