You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(mockery)
# set up the mockmock_download_file<- mock_function(return_value=TRUE)
mock_download_file(file="test.txt", url="http://example.com/test.txt")
# call the function that uses download.file
your_function_to_test()
# check the output
expect_true(mock_download_file.calls$file[1] =="test.txt")
expect_true(mock_download_file.calls$url[1] =="http://example.com/test.txt")
library(mockery)
mocked_response<-list(status=200, body="Mocked response")
# set up the mockmock_api_call<-mockery::mock_function(return_value=mocked_response)
# make the requestresponse<- mock_api_call()
# check the responseresponse
https://github.com/ropensci/vcr
https://github.com/ropensci/webmockr/
https://github.com/r-lib/mockery
https://github.com/nealrichardson/httptest
https://github.com/nealrichardson/httptest2
The text was updated successfully, but these errors were encountered: