httptest

A Test Environment for HTTP Requests

Testing and documenting code that communicates with remote servers can be painful. Dealing with authentication, server state, and other complications can make testing seem too costly to bother with. But it doesn't need to be that hard. This package enables one to test all of the logic on the R sides of the API in your package without requiring access to the remote service. Importantly, it provides three contexts that mock the network connection in different ways, as well as testing functions to assert that HTTP requests were---or were not---made. It also allows one to safely record real API responses to use as test fixtures. The ability to save responses and load them offline also enables one to write vignettes and other dynamic documents that can be distributed without access to a live server.

Total

28,020

Last month

1,036

Last week

205

Average per day

35

Daily downloads

Total downloads

Description file content

Package
httptest
Type
Package
Title
A Test Environment for HTTP Requests
Description
Testing and documenting code that communicates with remote servers can be painful. Dealing with authentication, server state, and other complications can make testing seem too costly to bother with. But it doesn't need to be that hard. This package enables one to test all of the logic on the R sides of the API in your package without requiring access to the remote service. Importantly, it provides three contexts that mock the network connection in different ways, as well as testing functions to assert that HTTP requests were---or were not---made. It also allows one to safely record real API responses to use as test fixtures. The ability to save responses and load them offline also enables one to write vignettes and other dynamic documents that can be distributed without access to a live server.
Version
3.2.2
URL
BugReports
https://github.com/nealrichardson/httptest/issues
License
MIT + file LICENSE
Depends
R (>= 3.0.0), testthat
Imports
digest, httr, jsonlite, stats, utils
Suggests
covr, knitr, rmarkdown, spelling, xml2
Language
en-US
RoxygenNote
6.1.1
VignetteBuilder
knitr
NeedsCompilation
no
Packaged
2018-12-07 04:14:18 UTC; npr
Author
Neal Richardson [aut, cre]
Maintainer
Neal Richardson
Repository
CRAN
Date/Publication
2018-12-07 05:30:11 UTC

install.packages('httptest')

3.2.2

5 months ago

https://enpiar.com/r/httptest

Neal Richardson

MIT + file LICENSE

Depends on

R (>= 3.0.0), testthat

Imports

digest, httr, jsonlite, stats, utils

Suggests

covr, knitr, rmarkdown, spelling, xml2

Discussions