Explicitly set accessToken to NULL in all tests

Change-Id: Id98d918b9668a8ea5720e790835a34604c52b350
diff --git a/tests/testthat/test-KorAPConnection.R b/tests/testthat/test-KorAPConnection.R
index b62aba2..0755b08 100644
--- a/tests/testthat/test-KorAPConnection.R
+++ b/tests/testthat/test-KorAPConnection.R
@@ -1,5 +1,5 @@
 test_that("KorAPConnection fails gracefully on unresolvable host", {
-  expect_message(new("KorAPConnection", apiUrl="http://xxx.asdhsahdsadhvgas.org"), "No internet|Could not resolve")
+  expect_message(new("KorAPConnection", accessToken = NULL, apiUrl="http://xxx.asdhsahdsadhvgas.org"), "No internet|Could not resolve")
 })
 
 test_that("KorAPConnection fails gracefully on timeout", {
@@ -11,13 +11,13 @@
 })
 
 test_that("KorAPConnection is printable", {
-  kco <- new("KorAPConnection", timeout = 1)
+  kco <- new("KorAPConnection", accessToken = NULL, timeout = 1)
   skip_if(is.null(kco@welcome))
   expect_error(print(kco), NA)
 })
 
 test_that("Opening KorAPConnection prints some message.", {
-  expect_message(new("KorAPConnection"), "KorAP")
+  expect_message(new("KorAPConnection", accessToken = NULL), "KorAP")
 })
 
 test_that("Opening KorAPConnection with invalid apiToken fails gracefully", {
@@ -26,7 +26,7 @@
 })
 
 test_that("Persisting null apiToken fails", {
-  kco <- new("KorAPConnection", timeout = 3)
+  kco <- new("KorAPConnection", accessToken = NULL, timeout = 3)
   skip_if_not(is.null(kco@accessToken))
   skip_if(is.null(kco@welcome))
   expect_error(persistAccessToken(kco),
@@ -35,8 +35,8 @@
 })
 
 test_that("Opening KorAPConnection with KorAPUrl works", {
-  kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de", timeout = 1)
+  kco <- new("KorAPConnection", accessToken = NULL, KorAPUrl="https://korap.ids-mannheim.de", timeout = 1)
   expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
-  kco <- new("KorAPConnection", KorAPUrl="https://korap.ids-mannheim.de/", timeout = 1)
+  kco <- new("KorAPConnection", accessToken = NULL, KorAPUrl="https://korap.ids-mannheim.de/", timeout = 1)
   expect_equal(kco@apiUrl, paste0("https://korap.ids-mannheim.de/api/", kco@apiVersion, "/"))
 })
diff --git a/tests/testthat/test-collocations.R b/tests/testthat/test-collocations.R
index 9734173..f847d8b 100644
--- a/tests/testthat/test-collocations.R
+++ b/tests/testthat/test-collocations.R
@@ -1,6 +1,6 @@
 test_that("collocationScoreQuery works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE)
   df <- collocationScoreQuery(kco, "Ameisenplage", "heimgesucht", leftContextSize=0, rightContextSize=1)
   expect_gt(df$logDice, 1)
   expect_equal(df$ll, ll(df$O1, df$O2, df$O, df$N, df$E, df$w))
diff --git a/tests/testthat/test-corpusQuery.R b/tests/testthat/test-corpusQuery.R
index f80a825..223f526 100644
--- a/tests/testthat/test-corpusQuery.R
+++ b/tests/testthat/test-corpusQuery.R
@@ -1,13 +1,13 @@
 test_that("frequencyQuery can be cached", {
   skip_if_offline()
-  kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE)
   frequencyQuery(kco, "Ameisenplage", "pubDate since 2014")
   expect_output(frequencyQuery(kco, "Ameisenplage", "pubDate since 2014"), "cached")
 })
 
 test_that("collocationScoreQuery works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
+  kco <- new("KorAPConnection",  accessToken = NULL, cache = TRUE, verbose = TRUE)
   df <- collocationScoreQuery(kco,"Ameisenplage", "heimgesucht", leftContextSize=0, rightContextSize=1)
   expect_gt(df$logDice, 1)
   expect_equal(df$ll, ll(df$O1, df$O2, df$O, df$N, df$E, df$w))
@@ -19,7 +19,7 @@
 
 test_that("Cache depends on indexRevision (handling also NULL values)", {
   skip_if_offline()
-  kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE)
   kco@indexRevision <- NULL
   frequencyQuery(kco, "Ameisenplage", "pubDate since 2014")
   kco@indexRevision <- as.character(Sys.time())
@@ -29,7 +29,7 @@
 
 test_that("corpusQuery returns results", {
   skip_if_offline()
-  q <- new("KorAPConnection") %>%
+  q <- new("KorAPConnection", accessToken = NULL) %>%
     corpusQuery("Ameisenplage")
   expect_gt(q@totalResults, 0)
 })
@@ -41,7 +41,7 @@
   Encoding(vc)="latin1"
 
   skip_if_offline()
-  q <- new("KorAPConnection") %>%
+  q <- new("KorAPConnection", accessToken = NULL) %>%
     corpusQuery(query, vc=vc)
   expect_gt(q@totalResults, 0)
 })
@@ -53,14 +53,14 @@
   Encoding(vc)="UTF-8"
 
   skip_if_offline()
-  q <- new("KorAPConnection") %>%
+  q <- new("KorAPConnection", accessToken = NULL) %>%
     corpusQuery(query, vc=vc)
   expect_gt(q@totalResults, 0)
 })
 
 test_that("fetchAll fetches all results with match positions", {
   skip_if_offline()
-  q <- new("KorAPConnection", verbose = TRUE) %>%
+  q <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     corpusQuery("Ameisenplage", vc = "pubDate since 2014")
   expectedResults <- q@totalResults
   matches <- fetchAll(q)@collectedMatches
@@ -72,7 +72,7 @@
 
 test_that("fetchAll fetches textClass metadatum", {
   skip_if_offline()
-  q <- new("KorAPConnection", verbose = TRUE) %>%
+  q <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     corpusQuery("Ameisenplage", vc = "pubDate since 2014")
   expectedResults <- q@totalResults
   matches <- fetchAll(q)@collectedMatches
@@ -83,13 +83,13 @@
 
 test_that("Uncached query for non-matching search string return 0 results", {
   skip_if_offline()
-  q <- new("KorAPConnection", cache = FALSE) %>% corpusQuery("Xmeisenplagx")
+  q <- new("KorAPConnection", accessToken = NULL, cache = FALSE) %>% corpusQuery("Xmeisenplagx")
   expect_equal( q@totalResults, 0)
 })
 
 test_that("Empty query result is printable", {
   skip_if_offline()
-  q <- new("KorAPConnection", cache = TRUE, verbose = TRUE) %>%
+  q <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE) %>%
     corpusQuery("Xmeisenplagx", vc = "pubDate in 2012") %>%
     fetchNext()
   expect_output(print(q), "Xmeisenplagx.*pubDate in 2012")
@@ -97,7 +97,7 @@
 
 test_that("Non-empty query result is printable", {
   skip_if_offline()
-  q <- new("KorAPConnection", cache = TRUE, verbose = TRUE) %>%
+  q <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE) %>%
     corpusQuery("Ameisenplage", "pubDate since 2014", fields=c("textSigle")) %>%
     fetchRest()
   expect_output(print(q), "Ameisenplage.*pubDate since 2014")
@@ -105,7 +105,7 @@
 
 test_that("Query from KorAP URL returns as many results as corresponding direct query", {
   skip_if_offline()
-  kco <- new("KorAPConnection")
+  kco <- new("KorAPConnection", accessToken = NULL)
   r1 <- corpusQuery(kco, KorAPUrl = "https://korap.ids-mannheim.de/?q=Ameisenplage&cq=pubDate+since+2014&ql=poliqarp")@totalResults
   r2 <- corpusQuery(kco, "Ameisenplage", "pubDate since 2014")@totalResults
   expect_equal(r1, r2)
@@ -113,7 +113,7 @@
 
 test_that("Typo in query causes error", {
   skip_if_offline()
-  kco <- new("KorAPConnection", verbose = TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, verbose = TRUE)
   expect_message(kco %>% corpusQuery("[[xx"), "unbalanced")
 })
 
@@ -147,7 +147,8 @@
 })
 
 test_that("extended metadata fields work cortrectly on instane KED", {
-  kco <- new("KorAPConnection", KorAPUrl = "https://korap.ids-mannheim.de/instance/ked", verbose = TRUE)
+  kco <- new("KorAPConnection", KorAPUrl = "https://korap.ids-mannheim.de/instance/ked", accessToken = NULL,
+             verbose = TRUE)
   q <- corpusQuery(
     kco,
     "einfache",
diff --git a/tests/testthat/test-corpusStats.R b/tests/testthat/test-corpusStats.R
index 345dd91..c25670d 100644
--- a/tests/testthat/test-corpusStats.R
+++ b/tests/testthat/test-corpusStats.R
@@ -1,6 +1,6 @@
 test_that("corpusStats works", {
   skip_if_offline()
-  stats <- new("KorAPConnection") %>% corpusStats("pubDate since 2020 & pubDate until 2021")
+  stats <- new("KorAPConnection", accessToken = NULL) %>% corpusStats("pubDate since 2020 & pubDate until 2021")
   expect_gt(stats@tokens, 0)
   expect_gt(stats@paragraphs, 0)
   expect_gt(stats@documents, 0)
@@ -9,7 +9,7 @@
 
 test_that("corpusStats with result as df works", {
   skip_if_offline()
-  stats <- new("KorAPConnection") %>% corpusStats("pubDate since 2020 & pubDate until 2021", as.df = TRUE)
+  stats <- new("KorAPConnection", accessToken = NULL) %>% corpusStats("pubDate since 2020 & pubDate until 2021", as.df = TRUE)
   expect_gt(stats$tokens, 0)
   expect_gt(stats$paragraphs, 0)
   expect_gt(stats$documents, 0)
@@ -18,12 +18,12 @@
 
 test_that("Printing corpusStats for the whole corpus works", {
   skip_if_offline()
-  stats <- new("KorAPConnection") %>% corpusStats()
+  stats <- new("KorAPConnection", accessToken = NULL) %>% corpusStats()
   expect_error(print(stats), NA)
 })
 
 test_that("Printing corpusStats for a sub-corpus works", {
   skip_if_offline()
-  stats <- new("KorAPConnection") %>% corpusStats("pubDate since 2020 & pubDate until 2021")
+  stats <- new("KorAPConnection", accessToken = NULL) %>% corpusStats("pubDate since 2020 & pubDate until 2021")
   expect_error(print(stats), NA)
 })
diff --git a/tests/testthat/test-demos.R b/tests/testthat/test-demos.R
index b51a4cd..2e1a0a3 100644
--- a/tests/testthat/test-demos.R
+++ b/tests/testthat/test-demos.R
@@ -2,7 +2,7 @@
   skip_if_offline()
   year <- c(2013:2018)
   alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
-  hc <- new("KorAPConnection", verbose = TRUE) %>%
+  hc <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     frequencyQuery(
       query = alternatives,
       vc = paste("textType = /Zeit.*/ & pubDate in", year),
@@ -17,7 +17,7 @@
   year <- c(2013:2018)
   alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
 
-  hc <- new("KorAPConnection", verbose = TRUE) %>%
+  hc <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     frequencyQuery(
       query = alternatives,
       vc = paste("textType = /Zeit.*/ & pubDate in", year),
@@ -32,7 +32,7 @@
   year <- c(2013:2018)
   alternatives <- c("macht []{0,3} Sinn", "ergibt []{0,3} Sinn")
 
-  hc <- new("KorAPConnection", verbose = TRUE) %>%
+  hc <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     frequencyQuery(
       query = alternatives,
       vc = paste("textType = /Zeit.*/ & pubDate in", year),
@@ -47,7 +47,7 @@
   year <- c(2013:2018)
   q <- c("macht []{0,3} Sinn")
 
-  hc <- new("KorAPConnection", verbose = TRUE) %>%
+  hc <- new("KorAPConnection", accessToken = NULL, verbose = TRUE) %>%
     frequencyQuery(
       query = q,
       vc = paste("textType = /Zeit.*/ & pubDate in", year),
@@ -59,7 +59,7 @@
 
 test_that("Auto conditions over time highcharter example works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", verbose=TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, verbose=TRUE)
   hc <- expand_grid(
     myconditions = c("textDomain = /Wirtschaft.*/",
                   "textDomain != /Wirtschaft.*/"),
@@ -76,7 +76,7 @@
 
 test_that("Single condition over time highcharter example works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", verbose=TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, verbose=TRUE)
   hc <- expand_grid(
     condition = c("textDomain = /Wirtschaft.*/"),
     year = (2011:2013)
@@ -92,7 +92,7 @@
 
 test_that("Multiple conditions over time highcharter example works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", verbose=TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, verbose=TRUE)
   hc <- expand_grid(
     condition = c("textDomain = /Wirtschaft.*/",
                   "textDomain != /Wirtschaft.*/"),
@@ -109,7 +109,7 @@
 
 test_that("Multiple conditions and queries over time highcharter example works", {
   skip_if_offline()
-  kco <- new("KorAPConnection", verbose=TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, verbose=TRUE)
   hc <- expand_grid(
     qx = c("[tt/l=Heuschrecke]", "Ameise"),
     condition = c("textDomain = /Wirtschaft.*/",
@@ -127,7 +127,7 @@
 
 test_that("collocationScoreQuery works with hchart and hc_add_onclick_korap_search", {
   skip_if_offline()
-  kco <- new("KorAPConnection", cache = TRUE, verbose = TRUE)
+  kco <- new("KorAPConnection", accessToken = NULL, cache = TRUE, verbose = TRUE)
   df <- collocationScoreQuery(kco,"Ameisenplage", "heimgesucht", leftContextSize=0, rightContextSize=1)
   hc <- hchart(df, type="spline", hcaes(label, logDice))
   hc <- hc_add_onclick_korap_search(hc)
diff --git a/tests/testthat/test-textMetadata.R b/tests/testthat/test-textMetadata.R
index 9a8610b..2355322 100644
--- a/tests/testthat/test-textMetadata.R
+++ b/tests/testthat/test-textMetadata.R
@@ -1,18 +1,18 @@
 test_that("textMetadata works", {
   skip_if_offline()
-  m <- new("KorAPConnection") %>% textMetadata(c("WUD17/B96/57558", "WUD17/A97/08541"))
+  m <- new("KorAPConnection", accessToken = NULL) %>% textMetadata(c("WUD17/B96/57558", "WUD17/A97/08541"))
   expect("textType" %in% names(m), "textMetadata value should contain a textType column")
 })
 
 
 test_that("textMetadata works for unknown text sigles", {
   skip_if_offline()
-  m <- new("KorAPConnection") %>% textMetadata(c("WUD17/B96/57558", "unknownsigle"))
+  m <- new("KorAPConnection", accessToken = NULL) %>% textMetadata(c("WUD17/B96/57558", "unknownsigle"))
   expect("errors" %in% names(m), "textMetadata should return an errors column if a text does not exist")
 })
 
 test_that("textMetadata works with list valued fields", {
   skip_if_offline()
-  m <- new("KorAPConnection") %>% textMetadata("WUD17/B96/57558")
+  m <- new("KorAPConnection", accessToken = NULL) %>% textMetadata("WUD17/B96/57558")
   expect("staat-gesellschaft\\tbiographien-interviews" == m$textClass[1], "multiple text classes / domnains should be tab separated")
 })