1 context("Http Request")
4 test_that("execyte raises exception if http verb is not valid", {
6 http <- HttpRequest$new()
7 expect_that(http$exec("FAKE VERB", "url"),
8 throws_error("Http verb is not valid."))
11 test_that("createQuery generates and encodes query portion of http", {
13 http <- HttpRequest$new()
15 queryParams$filters <- list(list("color", "=", "red"))
16 queryParams$limit <- 20
17 queryParams$offset <- 50
18 expect_that(http$createQuery(queryParams),
19 equals(paste0("/?filters=%5B%5B%22color%22%2C%22%3D%22%2C%22red",
20 "%22%5D%5D&limit=20&offset=50")))
23 test_that("createQuery generates and empty string when queryParams is an empty list", {
25 http <- HttpRequest$new()
26 expect_that(http$createQuery(list()), equals(""))