-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '79423363265fabc18ba971f1e969fff11dfeb247' #Conflicts: # NEWS.md
- Loading branch information
Showing
4 changed files
with
35 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: boxr | ||
Type: Package | ||
Title: Interface for the 'Box.com API' | ||
Version: 0.3.6.9006 | ||
Version: 0.3.6.9007 | ||
Authors@R: c( | ||
person("Brendan", "Rocks", email = "[email protected]", | ||
role = c("aut")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,27 @@ | ||
# Load/Save --------------------------------------------------------------- | ||
# For some reason (probably related to environements), these run fine in the | ||
# console/terminal, but testthat can't find the files when running them with | ||
# devtools::test() | ||
# | ||
# Leaving not-run, for now | ||
if (FALSE) { | ||
context("Load/Save") | ||
|
||
test_that("Saving R Object Remotely", { | ||
skip_on_cran() | ||
skip_if_no_token() | ||
|
||
# Here's an R object | ||
test_list <- list(data.frame(), 1:10, letters) | ||
test_vars$test_list <- test_list | ||
rda_name <- "test.RData" | ||
|
||
# The upload should throw an error if it doesn't work | ||
b <- box_save(test_list, envir = globalenv(), dir_id = 0, file_name = rda_name) | ||
|
||
# Put the id in an environment variable for subsequent tests | ||
test_vars$object_return <- b | ||
|
||
# Did the file end up with the right name? | ||
expect_equal(rda_name, b$entries[[1]]$name) | ||
}) | ||
|
||
test_that("Loading remote R object", { | ||
skip_on_cran() | ||
skip_if_no_token() | ||
|
||
rm("object") | ||
|
||
# Can you load the remote file which stores the R object? | ||
b <- box_load(test_vars$object_return$entries[[1]]$id) | ||
|
||
# Did it return the right object name? | ||
expect_equal("object", b) | ||
# Is the R object the same after it's journey? | ||
expect_equal(object, test_vars$object) | ||
}) | ||
|
||
} | ||
context("Load/Save") | ||
|
||
test_that("object can be saved, retrieved, and deleted", { | ||
skip_on_cran() | ||
skip_if_no_token() | ||
|
||
# Here's an R object | ||
test_ref <- list(data.frame(), 1:10, letters) | ||
|
||
test_list <- test_ref | ||
rda_name <- "test.RData" | ||
|
||
b_save <- box_save(test_list, dir_id = 0, file_name = rda_name) | ||
expect_equal(rda_name, b_save$name) | ||
|
||
rm("test_list") | ||
|
||
# will load data into `test_list` | ||
b_load <- box_load(b_save$id) | ||
expect_identical(b_load, "test_list") | ||
expect_equal(test_ref, test_list) | ||
|
||
# clean up | ||
box_delete_file(b_save$id) | ||
|
||
}) | ||
|