summaryrefslogtreecommitdiffstats
path: root/tests/test-config.R
blob: 57e3b3bf267805b2e9d07ea6b80522e6b72fe186 (plain)
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
library(cepis)
source(file.path("helper", "utils.R"))

check(
  "a trailing slash is stripped from base_url",
  identical(cepis_client(base_url = "http://x/")$base_url, "http://x")
)
check(
  "the user agent identifies the library",
  grepl("cepis-r/", cepis_client()$user_agent, fixed = TRUE)
)
check(
  "max_attempts below one is rejected",
  inherits(caught(cepis_client(max_attempts = 0L)), "error")
)
check(
  "a timeout of zero is rejected",
  inherits(caught(cepis_client(timeout = 0)), "error")
)
check(
  "a total_timeout of zero is rejected",
  inherits(caught(cepis_client(total_timeout = 0)), "error")
)
check(
  "the default base_url is the public API",
  identical(cepis_client()$base_url, "https://cep.is")
)