Commit 66b800a2 authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #362 from jiwalker-usgs/master

Test for POST issue
parents 9941f062 4bc86846
......@@ -309,3 +309,31 @@ test_that("NGWMN functions working", {
expect_equal(attr(tzDataMT$dateTime, 'tzone'), "US/Mountain")
expect_warning(tzDataUTC$dateTime == tzDataMT$dateTime)
})
context("getWebServiceData")
test_that("long urls use POST", {
url <- paste0(rep("reallylongurl", 200), collapse = '')
with_mock(
RETRY = function(method, ...) {
return(method == "POST")
},
status_code = function(resp) 200,
headers = function(resp) list(`content-type` = "logical"),
content = function(resp, encoding) resp,
expect_true(getWebServiceData(url)),
.env = "httr"
)
})
test_that("ngwmn urls don't use post", {
url <- paste0(rep("urlwithngwmn", 200), collapse = '')
with_mock(
RETRY = function(method, ...) {
return(method == "POST")
},
status_code = function(resp) 200,
headers = function(resp) list(`content-type` = "logical"),
content = function(resp, encoding) resp,
expect_false(getWebServiceData(url)),
.env = "httr"
)
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment