We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I was thinking about how we could test and I thought about the idea of mocking curl_fetch_memory.
curl_fetch_memory
Check this out:
curl_env <- environment(curl::curl_fetch_memory) old_curl_fetch_memory <- curl::curl_fetch_memory unlockBinding(quote(curl_fetch_memory), curl_env) assign("curl_fetch_memory", function(...) list( response_code = 200, content = charToRaw("Hello Curled!")), envir = curl_env) a <- curl::curl_fetch_memory("http://whatever") print(a) #> $response_code #> [1] 200 #> #> $content #> [1] 48 65 6c 6c 6f 20 43 75 72 6c 65 64 21 print(rawToChar(a$content)) #> [1] "Hello Curled!" assign("curl_fetch_memory", old_curl_fetch_memory, envir = curl_env) lockBinding(quote(curl_fetch_memory), curl_env) a <- curl::curl_fetch_memory("http://whatever") #> Error in curl::curl_fetch_memory("http://whatever"): Could not resolve host: whatever
Created on 2020-07-02 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered:
Some more relevant discoveries:
assignInNamespace()
testthat::with_mock()
Sorry, something went wrong.
No branches or pull requests
I was thinking about how we could test and I thought about the idea of mocking
curl_fetch_memory
.Check this out:
Created on 2020-07-02 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: