File: test_httr.R

package info (click to toggle)
r-bioc-biocfilecache 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 412 kB
  • sloc: sql: 63; sh: 13; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (3)
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
context("httr")

test_that("internal .httr_get_cache_info works", {

    # example neither
    url <- "http://httpbin.org/get"
    info <- .httr_get_cache_info(url)
    expect_identical(length(info), 3L)
    expect_identical(names(info), c("etag", "modified", "expires"))

    # example both
    url <- "https://www.wikipedia.org/"
    info <- .httr_get_cache_info(url)
    expect_true(all(!is.na(info)))
    expect_identical(length(info), 3L)
    expect_identical(names(info), c("etag", "modified", "expires"))

    # example only time
    url <- "https://en.wikipedia.org/wiki/Bioconductor"
    info <- .httr_get_cache_info(url)
    expect_true(is.na(info[["etag"]]))
    expect_true(!is.na(info[["modified"]]))
    expect_true(!is.na(info[["expires"]]))
    expect_identical(length(info), 3L)
    expect_identical(names(info), c("etag", "modified", "expires"))
    # more tests in bfcneedsupdate

})