Removed obsolated methods from HttpRequest class and updated tests to reflect that...
[arvados.git] / sdk / R / tests / testthat / test-HttpRequest.R
index 66ab9af19636a33f96e257eebbdf3fa0813add72..5c2fb602fdb1edb1bdee38e93b831a35c34bb6f0 100644 (file)
@@ -4,25 +4,24 @@ context("Http Request")
 test_that("execyte raises exception if http verb is not valid", {
 
     http <- HttpRequest$new()
-    expect_that(http$execute("FAKE VERB", "url"),
+    expect_that(http$exec("FAKE VERB", "url"),
                throws_error("Http verb is not valid."))
 }) 
 
-test_that(paste("createQuery generates and encodes query portion of http",
-                "request based on filters, limit and offset parameters"), {
+test_that("createQuery generates and encodes query portion of http", {
 
     http <- HttpRequest$new()
-    filters <- list(list("color", "=", "red"))
-    limit <- 20
-    offset <- 50
-    expect_that(http$createQuery(filters, limit, offset),
+    queryParams <- list()
+    queryParams$filters <- list(list("color", "=", "red"))
+    queryParams$limit <- 20
+    queryParams$offset <- 50
+    expect_that(http$createQuery(queryParams),
                 equals(paste0("/?filters=%5B%5B%22color%22%2C%22%3D%22%2C%22red",
                               "%22%5D%5D&limit=20&offset=50")))
 }) 
 
-test_that(paste("createQuery generates and empty string",
-                "when filters, limit and offset parameters are set to NULL"), {
+test_that("createQuery generates and empty string when queryParams is an empty list", {
 
     http <- HttpRequest$new()
-    expect_that(http$createQuery(NULL, NULL, NULL), equals(""))
+    expect_that(http$createQuery(list()), equals(""))
 })