nealrichardson / httptest

A Test Environment for HTTP Requests in R
https://enpiar.com/r/httptest/
Other
79 stars 10 forks source link

add with_mock_dir #48

Closed maelle closed 3 years ago

maelle commented 3 years ago

Fix #40

maelle commented 3 years ago

is there any write-up of how httptest tests work? asking because of my wondering how I'd add one.

maelle commented 3 years ago

Regarding the environment variable stuff. If I record the answer from an API with authentication, I want to use my real secrets for recording but when playing back I want to set up fake secrets so that the tests will run on contexts without access to secrets (forks, CRAN, etc.).

codecov-io commented 3 years ago

Codecov Report

Merging #48 (f2fa8cd) into master (541a48c) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #48   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        18    +1     
  Lines          447       451    +4     
=========================================
+ Hits           447       451    +4     
Impacted Files Coverage Δ
R/mock-dir.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 541a48c...f2fa8cd. Read the comment docs.

maelle commented 3 years ago

(thanks for the notes on testing!)

nealrichardson commented 3 years ago

I'll take a look, and if I can come up with anything better for testing, I'll push a commit to your branch.

nealrichardson commented 3 years ago

I simplified the code a bit and likely broke the interactive use case, but I think that needs a more general solution (#50). I'll work on that next.

The other thing to do here is make a pass over the docs and make sure with_mock_dir is discussed everywhere it should be.

maelle commented 3 years ago

Thanks for the review & improvements!