tests/testthat/test-zc_readings.R

context("zc_readings")

token <- Sys.getenv("ZC_TOKEN")
test_that("zc_statuses returns errors", {
  expect_error(zc_readings(token = "aaa", sn = "z6-00033"),
               regexp = "Invalid token.")
  skip_if(token == "")
  expect_error(zc_readings(token = token, sn = "aaa"),
               regexp = "Missing query string parameter.")
})

skip_if(token == "")
readings <- zc_readings(token = token,
                        sn = "z6-00033",
                        start_time = as.numeric(as.POSIXct(Sys.Date(), origin = "1970-01-01"))
)

test_that("zc_statuses works as expected", {
  expect_is(readings, "list")
  expect_true(
    all(names(readings) %in% c("device", "get_readings_ver", "created")))
})

Try the rzentra package in your browser

Any scripts or data that you put into this service are public.

rzentra documentation built on Dec. 21, 2020, 5:07 p.m.