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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
context("ping - regular mode")
test_that("ping works", {
skip_on_cran()
skip_if_not(!is_in_cloud_mode(conn))
if (!conn$core_exists("gettingstarted")) conn$core_create("gettingstarted")
aa <- conn$ping(name = "gettingstarted")
expect_is(aa, "list")
expect_is(aa$responseHeader, "list")
expect_equal(aa$responseHeader$status, 0)
expect_equal(aa$responseHeader$params$q, "{!lucene}*:*")
})
test_that("ping gives raw data correctly", {
skip_on_cran()
skip_if_not(!is_in_cloud_mode(conn))
expect_is(ping("gettingstarted", raw = TRUE), "ping")
expect_is(ping("gettingstarted", raw = FALSE), "list")
expect_is(ping("gettingstarted", wt = "xml", raw = TRUE), "ping")
expect_is(ping("gettingstarted", wt = "xml", raw = FALSE), "xml_document")
})
test_that("ping fails well", {
skip_on_cran()
skip_if_not(!is_in_cloud_mode(conn))
expect_equal(ping()$status, "not found")
expect_equal(ping("adfdafs")$status, "not found")
})
context("ping - cloud mode")
test_that("ping works", {
skip_on_cran()
skip_if_not(is_in_cloud_mode(conn))
if (!conn$collection_exists("gettingstarted")) {
conn$collection_create("gettingstarted")
}
aa <- conn$ping(name = "gettingstarted")
expect_is(aa, "list")
expect_is(aa$responseHeader, "list")
expect_equal(aa$responseHeader$status, 0)
expect_equal(aa$responseHeader$params$q, "{!lucene}*:*")
})
test_that("ping gives raw data correctly", {
skip_on_cran()
skip_if_not(is_in_cloud_mode(conn))
expect_is(ping(conn, "gettingstarted", raw = TRUE), "ping")
expect_is(ping(conn, "gettingstarted", raw = FALSE), "list")
expect_is(ping(conn, "gettingstarted", wt = "xml", raw = TRUE), "ping")
expect_is(ping(conn, "gettingstarted", wt = "xml", raw = FALSE), "xml_document")
})
test_that("ping fails well", {
skip_on_cran()
skip_if_not(is_in_cloud_mode(conn))
expect_error(conn$ping()$status, "argument \"name\" is missing")
expect_equal(conn$ping("adfdafs")$status, "not found")
})
|