1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 context("Http Request")
8 test_that("execyte raises exception if http verb is not valid", {
10 http <- HttpRequest$new()
11 expect_that(http$exec("FAKE VERB", "url"),
12 throws_error("Http verb is not valid."))
15 test_that("createQuery generates and encodes query portion of http", {
17 http <- HttpRequest$new()
19 queryParams$filters <- list(list("color", "=", "red"))
20 queryParams$limit <- 20
21 queryParams$offset <- 50
22 expect_that(http$createQuery(queryParams),
23 equals(paste0("/?filters=%5B%5B%22color%22%2C%22%3D%22%2C%22red",
24 "%22%5D%5D&limit=20&offset=50")))
27 test_that("createQuery generates and empty string when queryParams is an empty list", {
29 http <- HttpRequest$new()
30 expect_that(http$createQuery(list()), equals(""))