disqus / python-phabricator

Python bindings for Phabricator
Apache License 2.0
159 stars 66 forks source link

Mocking resources #48

Closed schancel closed 6 years ago

schancel commented 6 years ago

Any idea how "methods" on this library can be mocked out? I'm trying to write several tests for another system that uses it, and nothing I do with the mock library seems to be able to replace the __call__ or _request functions on a particular instance of a Resource class.

aljungberg commented 6 years ago

Not a direct answer to your question, but I successfully wrote tests using vcr. It captured and replayed the requests made by this library.

(VCR uses a kind of shotgun approach: as far as I can tell it patches urllib, httplib2 and many others.)

schancel commented 6 years ago

Ah that's a good point. Thank you for that. I'm use to less dynamic languages.