Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
fixed notes and errors found by check_win and check_rhub
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotov committed Oct 10, 2019
1 parent 9f7a2a9 commit c1b92fb
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 87 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^_pkgdown\.yml$
^\.travis\.yml$
^codecov\.yml$
^vignettes/cumulocityr\.Rmd$
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cumulocityr
Type: Package
Title: R client for the Cumulocity API
Version: 0.1.0.9000
Title: R Client for the Cumulocity API
Version: 0.1.0
Authors@R: c(
person("Dmitriy", "Bolotov", email = "rpmmlsupport@softwareag.com", role = c("aut", "cre")),
person("Software AG", role = c("cph")))
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# cumulocityr 0.1.0

* Added a `NEWS.md` file to track changes to the package.
* Added functions `get_devices`, `get_events`, and `get_measurements`.
2 changes: 1 addition & 1 deletion R/cumulocityr.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# GNU General Public License for details (http://www.gnu.org/licenses/).
# #############################################################################

#' R client for the Cumulocity API
#' R Client for the Cumulocity API
#'
#' This package contains functions to interact with the Cumulocity API.
#'
Expand Down
18 changes: 0 additions & 18 deletions tests/testthat/test_get_devices.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@ test_that("get_devices returns data.frame", {
})


# test_that("time is parsed or not depending on parse_datetime", {
# skip_on_cran()
#
# result_04 <- get_devices(num_rows = 2)
# result_05 <- get_devices(num_rows = 10, parse_datetime = FALSE)
#
# expect_true(inherits(result_04$creationTime[1], "POSIXlt"))
# expect_true(inherits(result_04$lastUpdated[1], "POSIXlt"))
# expect_true(inherits(result_04$c8y_Availability$lastMessage[1], "POSIXlt"))
#
# result_05_row <- result_05[which(result_05$id == .get_cumulocity_device_id()), ]
#
# expect_true(is.character(result_05_row$creationTime[1]))
# expect_true(is.character(result_05_row$lastUpdated[1]))
# expect_true(is.character(result_05_row$c8y_Availability.lastMessage[1]))
# })


test_that("parse_json = FALSE returns character string", {
skip_on_cran()

Expand Down
28 changes: 1 addition & 27 deletions tests/testthat/test_get_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ context("test get_events")
test_that("page_size controls number of records returned", {
skip_on_cran()

# results used in test_get_events.R
result_06 <- get_events(
device_id = .get_cumulocity_device_id(),
date_from = "2019-09-30T20:00:00Z",
Expand All @@ -20,32 +19,6 @@ test_that("page_size controls number of records returned", {
expect_equal(NROW(result_07), 4)
})

# test_that("time is parsed or not depending on parse_datetime", {
# skip_on_cran()
#
# result_06 <- get_events(
# device_id = .get_cumulocity_device_id(),
# date_from = "2019-09-30T20:00:00Z",
# num_rows = 2
# )
#
# result_07 <- get_events(
# device_id = .get_cumulocity_device_id(),
# date_from = "2019-09-30T20:00:00Z",
# num_rows = 4, parse_datetime = FALSE
# )
#
# expect_true(inherits(result_06$time[1], "POSIXlt"))
# expect_true(is.character(result_07$time[1]))
# })

# test_that("warning message is issued when measurements list is empty", {
# skip_on_cran()
# expect_warning(get_events(123, date_from = "2019-09-30T20:00:00Z"),
# "No events found on page 1.",
# fixed = TRUE
# )
# })

test_that("parse_json = FALSE returns character string", {
skip_on_cran()
Expand All @@ -61,6 +34,7 @@ test_that("parse_json = FALSE returns character string", {


test_that("when num_rows is NULL, return all records between two dates", {
skip_on_cran()
result_11 <- get_events(
device_id = .get_cumulocity_device_id(),
date_from = "2019-09-30T00:00:00Z", date_to = "2019-10-01T04:40:10Z"
Expand Down
39 changes: 1 addition & 38 deletions tests/testthat/test_get_measurements.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,15 @@ test_that("page_size controls number of records returned", {
expect_equal(NROW(result_02), 11)
})

# test_that("time is parsed or not depending on parse_datetime", {
# skip_on_cran()
#
# result_01 <- get_measurements(
# device_id = .get_cumulocity_device_id(),
# date_from = "2019-09-30T20:00:00Z",
# num_rows = 2
# )
#
# result_02 <- get_measurements(
# device_id = .get_cumulocity_device_id(),
# date_from = "2019-09-30T20:00:00Z",
# num_rows = 11, parse_datetime = FALSE
# )
#
# expect_true(inherits(result_01$time[1], "POSIXlt"))
# expect_true(is.character(result_02$time[1]))
# })


test_that("when num_rows is NULL, return all records between two dates", {
skip_on_cran()
result_10 <- get_measurements(
device_id = .get_cumulocity_device_id(),
date_from = "2019-10-01T00:00:00Z", date_to = "2019-10-01T00:00:10Z"
)
expect_equal(NROW(result_10), 2)
})

# test_that("what happens when num_rows is very large but there is only data on page 1?", {
# get_measurements(device_id = .get_cumulocity_device_id(),
# date_from = "2019-10-01T02:00:00Z")
# })



# test_that("warning message is issued when measurements list is empty", {
# skip_on_cran()
# # Measurements list is empty because the device_id does not exist.
# expect_warning(get_measurements(
# device_id = 123,
# date_from = "2019-09-30T20:00:00Z"
# ),
# "No measurements found on page 1.",
# fixed = TRUE
# )
# })

test_that("parse_json = FALSE returns character string", {
skip_on_cran()
Expand Down

0 comments on commit c1b92fb

Please sign in to comment.