Closed byapparov closed 7 years ago
Thanks! I see that with_mock_API
did not work with real URLs (those starting with http:// or any other protocol), only mock files paths. The commit linked above addresses that. Can you pull that branch and see if it meets your needs? If not, could you please add a failing test or two to test-mock-api.R and make a pull request back?
With the new commit, your mock for that request would go in tests/testthat/mydomain.zendesk.com/api/v2/incremental/tickets.json
plus some hash of the querystring, I think. If you write the test, the with_mock_API
context will tell you where it looked for the file if it doesn't find one.
Thank you @nealrichardson, it works fine. Very useful package!
Ok, merged that branch in and tagged a release: https://github.com/nealrichardson/httptest/releases/tag/1.1.2
Can't put it on CRAN just yet because the previous release was only a few days ago, but you can devtools::install_github
that tag. Thanks for your feedback!
Hi,
I am not sure how to use
with_mock_API
against the full URL that containshttp(s)://{domain}
. Where the json files should be located in this case?For example if I want to do something like this in my package:
Can I mock the response?