blob: 298a333e9f1e5e98f2e563faefe63e27ab5e6db6 [file] [log] [blame]
Marc Kupietz5d9e3a22020-03-23 09:03:29 +01001test_that("KorAPConnection is printable", {
2 kco <- new("KorAPConnection")
3 expect_error(print(kco), NA)
4})
5
Marc Kupietz5d9e3a22020-03-23 09:03:29 +01006test_that("Opening KorAPConnection with apiToken works", {
7 kco <- new("KorAPConnection", accessToken="test token")
8 persistAccessToken(kco)
9 kco <- new("KorAPConnection")
10 expect_equal(kco@accessToken, "test token")
11 clearAccessToken(kco)
12 kco <- new("KorAPConnection")
13 expect_null(kco@accessToken)
14 expect_error(persistAccessToken(kco),
15 ".*not supplied any access token.*",
16 perl = TRUE)
17})
18
19test_that("Opening KorAPConnection with KorAPUrl works", {
20 kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de")
21 expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
22 kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de/")
23 expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
24})