test_that("getWebDavHostName calls REST service properly", {
- expectedURL <- "https://host/discovery/v1/apis/arvados/v1/rest"
- serverResponse <- list(keepWebServiceUrl = "https://myWebDavServer.com")
+ expectedURL <- "https://host/arvados/v1/config"
+ serverResponse <- list(Services = list(WebDAVDownload = list(ExternalURL = "https://myWebDavServer.com")))
httpRequest <- FakeHttpRequest$new(expectedURL, serverResponse)
REST <- RESTService$new("token", "host",
REST$getWebDavHostName()
- expect_that(httpRequest$URLIsProperlyConfigured, is_true())
- expect_that(httpRequest$requestHeaderContainsAuthorizationField, is_true())
+ expect_true(httpRequest$URLIsProperlyConfigured)
+ expect_false(httpRequest$requestHeaderContainsAuthorizationField)
expect_that(httpRequest$numberOfGETRequests, equals(1))
})
test_that("getWebDavHostName returns webDAV host name properly", {
- serverResponse <- list(keepWebServiceUrl = "https://myWebDavServer.com")
+ serverResponse <- list(Services = list(WebDAVDownload = list(ExternalURL = "https://myWebDavServer.com")))
httpRequest <- FakeHttpRequest$new(expectedURL = NULL, serverResponse)
REST <- RESTService$new("token", "host",
REST$create("file", uuid)
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
expect_that(fakeHttp$numberOfPUTRequests, equals(1))
})
REST$delete("file", uuid)
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
expect_that(fakeHttp$numberOfDELETERequests, equals(1))
})
REST$move("file", "newDestination/file", uuid)
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
- expect_that(fakeHttp$requestHeaderContainsDestinationField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
+ expect_true(fakeHttp$requestHeaderContainsDestinationField)
expect_that(fakeHttp$numberOfMOVERequests, equals(1))
})
REST$copy("file", "newDestination/file", uuid)
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
- expect_that(fakeHttp$requestHeaderContainsDestinationField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
+ expect_true(fakeHttp$requestHeaderContainsDestinationField)
expect_that(fakeHttp$numberOfCOPYRequests, equals(1))
})
returnedContentMatchExpected <- all.equal(returnResult,
c("animal", "animal/dog", "ball"))
- expect_that(returnedContentMatchExpected, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
+ expect_true(returnedContentMatchExpected)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
})
test_that("getCollectionContent raises exception if server returns empty response", {
returnedContentMatchExpected <- all.equal(returnResult,
c(6, 2, 931, 12003))
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
- expect_that(returnedContentMatchExpected, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
+ expect_true(returnedContentMatchExpected)
})
test_that("getResourceSize raises exception if server returns empty response", {
returnResult <- REST$read("file", uuid, "text", 1024, 512)
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
- expect_that(fakeHttp$requestHeaderContainsRangeField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
+ expect_true(fakeHttp$requestHeaderContainsRangeField)
expect_that(returnResult, equals("file content"))
})
REST$write("file", uuid, fileContent, "text/html")
- expect_that(fakeHttp$URLIsProperlyConfigured, is_true())
- expect_that(fakeHttp$requestBodyIsProvided, is_true())
- expect_that(fakeHttp$requestHeaderContainsAuthorizationField, is_true())
- expect_that(fakeHttp$requestHeaderContainsContentTypeField, is_true())
+ expect_true(fakeHttp$URLIsProperlyConfigured)
+ expect_true(fakeHttp$requestBodyIsProvided)
+ expect_true(fakeHttp$requestHeaderContainsAuthorizationField)
+ expect_true(fakeHttp$requestHeaderContainsContentTypeField)
})
test_that("write raises exception if server response code is not between 200 and 300", {