blob: 298a333e9f1e5e98f2e563faefe63e27ab5e6db6 [file] [log] [blame]
test_that("KorAPConnection is printable", {
kco <- new("KorAPConnection")
expect_error(print(kco), NA)
})
test_that("Opening KorAPConnection with apiToken works", {
kco <- new("KorAPConnection", accessToken="test token")
persistAccessToken(kco)
kco <- new("KorAPConnection")
expect_equal(kco@accessToken, "test token")
clearAccessToken(kco)
kco <- new("KorAPConnection")
expect_null(kco@accessToken)
expect_error(persistAccessToken(kco),
".*not supplied any access token.*",
perl = TRUE)
})
test_that("Opening KorAPConnection with KorAPUrl works", {
kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de")
expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de/")
expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
})