/usr/share/doc/r-cran-crul/tests/testthat/test-put.R is in r-cran-crul 0.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | context("request: put")
test_that("put request works", {
skip_on_cran()
cli <- HttpClient$new(url = "https://httpbin.org")
aa <- cli$put("put")
expect_is(aa, "HttpResponse")
expect_is(aa$handle, 'curl_handle')
expect_is(aa$content, "raw")
expect_is(aa$method, "character")
expect_equal(aa$method, "put")
expect_is(aa$parse, "function")
expect_is(aa$parse(), "character")
expect_true(aa$success())
expect_null(aa$request$fields)
})
test_that("put request with body", {
skip_on_cran()
cli <- HttpClient$new(url = "https://httpbin.org")
aa <- cli$put("put", body = list(hello = "world"))
expect_is(aa, "HttpResponse")
expect_is(aa$handle, 'curl_handle')
expect_is(aa$content, "raw")
expect_is(aa$method, "character")
expect_equal(aa$method, "put")
expect_is(aa$parse, "function")
expect_is(aa$parse("UTF-8"), "character")
expect_true(aa$success())
expect_named(aa$request$fields, "hello")
expect_equal(aa$request$fields[[1]], "world")
})
|