Marc Kupietz | 5d9e3a2 | 2020-03-23 09:03:29 +0100 | [diff] [blame] | 1 | test_that("KorAPConnection is printable", { |
| 2 | kco <- new("KorAPConnection") |
| 3 | expect_error(print(kco), NA) |
| 4 | }) |
| 5 | |
Marc Kupietz | 5d9e3a2 | 2020-03-23 09:03:29 +0100 | [diff] [blame] | 6 | test_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 | |
| 19 | test_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 | }) |