Removed all autogenerated Arvados classes and updated rest of the code to reflect...
[arvados.git] / sdk / R / tests / testthat / test-Subcollection.R
index eafc74734b76b384b5ff8658223433f1ee664b86..b2b0bc9ccfecc66998e43f7d7b6de40c31a6d68e 100644 (file)
@@ -117,9 +117,10 @@ test_that(paste("add post content to a REST service",
     collectionContent <- c("animal", "animal/fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
     animal <- collection$get("animal")
     dog <- ArvadosFile$new("dog")
 
@@ -167,8 +168,9 @@ test_that(paste("remove removes content from REST service",
     collectionContent <- c("animal", "animal/fish", "animal/dog")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
     animal <- collection$get("animal")
 
     animal$remove("fish")
@@ -276,8 +278,9 @@ test_that("move raises exception if new location contains content with the same
                            "fish")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
     fish <- collection$get("animal/fish")
 
     expect_that(fish$move("fish"),
@@ -295,8 +298,10 @@ test_that(paste("move raises exception if newLocationInCollection",
                            "ball")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+
+    collection <- Collection$new(api, "myUUID")
     fish <- collection$get("animal/fish")
 
     expect_that(fish$move("objects/dog"),
@@ -312,8 +317,9 @@ test_that("move moves subcollection inside collection tree", {
                            "ball")
     fakeREST <- FakeRESTService$new(collectionContent)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
     fish <- collection$get("animal/fish")
 
     fish$move("fish")
@@ -339,11 +345,12 @@ test_that(paste("getSizeInBytes delegates size calculation",
     returnSize <- 100
     fakeREST <- FakeRESTService$new(collectionContent, returnSize)
 
-    collection <- Collection$new("fakeUUID")
-    collection$setRESTService(fakeREST)
+    api <- Arvados$new("myToken", "myHostName")
+    api$setRESTService(fakeREST)
+    collection <- Collection$new(api, "myUUID")
     animal <- collection$get("animal")
 
     resourceSize <- animal$getSizeInBytes()
 
     expect_that(resourceSize, equals(100))
-}) 
+})