context("ArvadosFile")
+test_that("constructor raises error if file name is empty string", {
+
+ expect_that(ArvadosFile$new(""), throws_error("Invalid name."))
+})
+
test_that("getFileListing always returns file name", {
dog <- ArvadosFile$new("dog")
expect_that(fakeREST$readCallCount, equals(1))
})
-test_that(paste("connect returns textConnection opened",
- "in read mode when 'r' is passed as argument"), {
+test_that(paste("connection delegates connection creation ro RESTService class",
+ "which returns curl connection opened in read mode when",
+ "'r' of 'rb' is passed as argument"), {
collectionContent <- c("animal", "animal/fish")
- readContent <- "file content"
- fakeREST <- FakeRESTService$new(collectionContent, readContent)
+ fakeREST <- FakeRESTService$new(collectionContent)
api <- Arvados$new("myToken", "myHostName")
api$setRESTService(fakeREST)
connection <- fish$connection("r")
- expect_that(readLines(connection), equals("file content"))
+ expect_that(fakeREST$getConnectionCallCount, equals(1))
})
-test_that(paste("connect returns textConnection opened",
+test_that(paste("connection returns textConnection opened",
"in write mode when 'w' is passed as argument"), {
-
collectionContent <- c("animal", "animal/fish")
fakeREST <- FakeRESTService$new(collectionContent)
"animal/dog",
"animal/fish/shark",
"ball")
+
fakeREST <- FakeRESTService$new(collectionContent)
api <- Arvados$new("myToken", "myHostName")
"animal/dog",
"animal/fish/shark",
"dog")
+
fakeREST <- FakeRESTService$new(collectionContent)
api <- Arvados$new("myToken", "myHostName")
"animal/dog",
"animal/fish/shark",
"ball")
+
fakeREST <- FakeRESTService$new(collectionContent)
api <- Arvados$new("myToken", "myHostName")