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
|
context("schema - cloud mode")
test_that("both R6 and normal function call work", {
skip_on_cran()
expect_is(conn$schema, "function")
expect_equal(names(formals(schema))[1], "conn")
})
test_that("schema works against", {
skip_on_cran()
skip_if_not(!is_in_cloud_mode(conn))
aa <- conn$schema(name = "gettingstarted")
bb <- conn$schema(name = "gettingstarted", what = "fields")
expect_is(conn$schema(name = "gettingstarted", "dynamicfields"), "list")
expect_is(conn$schema(name = "gettingstarted", "fieldtypes"), "list")
expect_is(conn$schema(name = "gettingstarted", "copyfields"), "list")
expect_is(conn$schema(name = "gettingstarted", "name"), "list")
expect_is(conn$schema(name = "gettingstarted", "version"), "list")
expect_is(conn$schema(name = "gettingstarted", "uniquekey"), "list")
expect_is(conn$schema(name = "gettingstarted", "similarity"), "list")
expect_is(aa, "list")
expect_is(aa$responseHeader, "list")
expect_is(aa$schema, "list")
expect_is(aa$schema$name, "character")
expect_is(bb, "list")
expect_is(bb$fields, "data.frame")
})
test_that("schema fails well", {
skip_on_cran()
skip_if_not(!is_in_cloud_mode(conn))
expect_error(conn$schema(), "argument \"name\" is missing")
expect_error(conn$schema(name = "gettingstarted", "stuff"), "Not Found")
})
test_that("schema old style works", {
skip_on_cran()
expect_is(schema(conn, name = "gettingstarted"),
"list"
)
})
|