Integrated autogenerated classes with existing content
[arvados.git] / sdk / R / tests / testthat / test-ArvadosFile.R
index 90cc1499d674df18f075876c4e2ba0bf028f06e7..67ed0f6240938562ff5cb7894201205926c3c494 100644 (file)
@@ -45,9 +45,8 @@ test_that(paste("getSizeInBytes delegates size calculation",
     returnSize <- 100
     fakeREST <- FakeRESTService$new(collectionContent, returnSize)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
 
     resourceSize <- fish$getSizeInBytes()
@@ -81,9 +80,8 @@ test_that("read raises exception offset or length is negative number", {
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
 
     expect_that(fish$read(contentType = "text", offset = -1),
@@ -100,9 +98,8 @@ test_that("read delegates reading operation to REST service class", {
     readContent <- "my file"
     fakeREST <- FakeRESTService$new(collectionContent, readContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
     
     fileContent <- fish$read("text")
@@ -118,9 +115,8 @@ test_that(paste("connection delegates connection creation ro RESTService class",
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
 
     connection <- fish$connection("r")
@@ -134,9 +130,8 @@ test_that(paste("connection returns textConnection opened",
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
 
     connection <- fish$connection("w")
@@ -156,9 +151,8 @@ test_that("flush sends data stored in a connection to a REST server", {
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
 
     connection <- fish$connection("w")
@@ -184,9 +178,8 @@ test_that("write delegates writing operation to REST service class", {
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     fish <- collection$get("animal/fish")
     
     fileContent <- fish$write("new file content")
@@ -215,10 +208,8 @@ test_that(paste("move raises exception if newLocationInCollection",
 
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     dog <- collection$get("animal/dog")
 
     expect_that(dog$move("objects/dog"),
@@ -236,9 +227,8 @@ test_that("move raises exception if new location contains content with the same
 
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     dog <- collection$get("animal/dog")
 
     expect_that(dog$move("dog"),
@@ -257,9 +247,8 @@ test_that("move moves arvados file inside collection tree", {
 
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    api <- Arvados$new("myToken", "myHostName")
-    api$setRESTService(fakeREST)
-    collection <- Collection$new(api, "myUUID")
+    collection <- Collection$new("fakeUUID")
+    collection$setRESTService(fakeREST)
     dog <- collection$get("animal/dog")
 
     dog$move("dog")