1 context("Http Request")
4 test_that("execyte raises exception if http verb is not valid", {
6 http <- HttpRequest$new()
7 expect_that(http$execute("FAKE VERB", "url"),
8 throws_error("Http verb is not valid."))
11 test_that(paste("createQuery generates and encodes query portion of http",
12 "request based on filters, limit and offset parameters"), {
14 http <- HttpRequest$new()
15 filters <- list(list("color", "=", "red"))
18 expect_that(http$createQuery(filters, limit, offset),
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(paste("createQuery generates and empty string",
24 "when filters, limit and offset parameters are set to NULL"), {
26 http <- HttpRequest$new()
27 expect_that(http$createQuery(NULL, NULL, NULL), equals(""))