Running 'testthat.R' [5s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(birdnik)
  Loading required package: httr
  > 
  > test_check("birdnik")
  -- 1. Error: Definition retrieval works (@test_birdnik.R#7)  -------------------
  Unauthorized (HTTP 401).
  1: word_definitions(key = key, words = "cat") at testthat/test_birdnik.R:7
  2: lapply(param, query, key = key)
  3: FUN(X[[i]], ...)
  4: httr::stop_for_status(result)
  
  -- 2. Error: Example retrieval works (@test_birdnik.R#21)  ---------------------
  Unauthorized (HTTP 401).
  1: related_words(key = key, words = c("cat", "madeupkey")) at testthat/test_birdnik.R:21
  2: do.call("rbind", mapply(function(param, key, word, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, related_word = NA, stringsAsFactors = FALSE))
         }
         return(do.call("rbind", lapply(result, function(entry, word) {
             return(data.frame(word = word, type = unname(unlist(entry$relationshipType)), 
                 related_word = unname(unlist(entry$words)), stringsAsFactors = FALSE))
         }, word = word)))
     }, param = param, key = key, word = words, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE))
  3: mapply(function(param, key, word, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, related_word = NA, stringsAsFactors = FALSE))
         }
         return(do.call("rbind", lapply(result, function(entry, word) {
             return(data.frame(word = word, type = unname(unlist(entry$relationshipType)), 
                 related_word = unname(unlist(entry$words)), stringsAsFactors = FALSE))
         }, word = word)))
     }, param = param, key = key, word = words, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE)
  4: (function (param, key, word, ...) 
     {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, related_word = NA, stringsAsFactors = FALSE))
         }
         return(do.call("rbind", lapply(result, function(entry, word) {
             return(data.frame(word = word, type = unname(unlist(entry$relationshipType)), 
                 related_word = unname(unlist(entry$words)), stringsAsFactors = FALSE))
         }, word = word)))
     })(param = dots[[1L]][[1L]], key = dots[[2L]][[1L]], word = dots[[3L]][[1L]])
  5: query(key, param, ...)
  6: httr::stop_for_status(result)
  
  -- 3. Error: pronounciation retrieval works (@test_birdnik.R#29)  --------------
  Unauthorized (HTTP 401).
  1: word_pronunciations(key = key, words = c("cat", "dog")) at testthat/test_birdnik.R:29
  2: do.call("rbind", mapply(FUN = function(param, key, word, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, type_seq = NA, pronunciation = NA, 
                 stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, type = unname(result[names(result) == "rawType"]), 
             type_seq = as.integer(unname(result[names(result) == "seq"])), pronunciation = unname(result[names(result) == 
                 "raw"]), stringsAsFactors = FALSE))
     }, param = param, key = key, word = words, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE))
  3: mapply(FUN = function(param, key, word, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, type_seq = NA, pronunciation = NA, 
                 stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, type = unname(result[names(result) == "rawType"]), 
             type_seq = as.integer(unname(result[names(result) == "seq"])), pronunciation = unname(result[names(result) == 
                 "raw"]), stringsAsFactors = FALSE))
     }, param = param, key = key, word = words, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE)
  4: (function (param, key, word, ...) 
     {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, type = NA, type_seq = NA, pronunciation = NA, 
                 stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, type = unname(result[names(result) == "rawType"]), 
             type_seq = as.integer(unname(result[names(result) == "seq"])), pronunciation = unname(result[names(result) == 
                 "raw"]), stringsAsFactors = FALSE))
     })(param = dots[[1L]][[1L]], key = dots[[2L]][[1L]], word = dots[[3L]][[1L]])
  5: query(key, param, ...)
  6: httr::stop_for_status(result)
  
  -- 4. Error: frequency retrieval works (@test_birdnik.R#37)  -------------------
  Unauthorized (HTTP 401).
  1: word_frequency(key = key, words = c("cat", "dog")) at testthat/test_birdnik.R:37
  2: do.call("rbind", lapply(param, function(x, key, ...) {
         single_result <- query(key, x, ...)
         frequencies <- unlist(single_result$frequency)
         return(data.frame(word = single_result$word, year = frequencies[names(frequencies) == 
             "year"], count = frequencies[names(frequencies) == "count"], stringsAsFactors = FALSE))
     }, key = key, ...))
  3: lapply(param, function(x, key, ...) {
         single_result <- query(key, x, ...)
         frequencies <- unlist(single_result$frequency)
         return(data.frame(word = single_result$word, year = frequencies[names(frequencies) == 
             "year"], count = frequencies[names(frequencies) == "count"], stringsAsFactors = FALSE))
     }, key = key, ...)
  4: FUN(X[[i]], ...)
  5: query(key, x, ...)
  6: httr::stop_for_status(result)
  
  -- 5. Error: bigram retrieval works (@test_birdnik.R#44)  ----------------------
  Unauthorized (HTTP 401).
  1: word_bigrams(key = key, words = c("cat", "dog")) at testthat/test_birdnik.R:44
  2: do.call("rbind", mapply(function(param, word, key, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, first_gram = NA, second_gram = NA, mi = NA, 
                 wlmi = NA, stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, first_gram = unname(result[names(result) == "gram1"]), 
             second_gram = unname(result[names(result) == "gram2"]), mi = as.numeric(unname(result[names(result) == 
                 "mi"])), wlmi = as.numeric(unname(result[names(result) == "wlmi"])), 
             stringsAsFactors = FALSE))
     }, param = param, word = words, key = key, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE))
  3: mapply(function(param, word, key, ...) {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, first_gram = NA, second_gram = NA, mi = NA, 
                 wlmi = NA, stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, first_gram = unname(result[names(result) == "gram1"]), 
             second_gram = unname(result[names(result) == "gram2"]), mi = as.numeric(unname(result[names(result) == 
                 "mi"])), wlmi = as.numeric(unname(result[names(result) == "wlmi"])), 
             stringsAsFactors = FALSE))
     }, param = param, word = words, key = key, ..., SIMPLIFY = FALSE, USE.NAMES = FALSE)
  4: (function (param, word, key, ...) 
     {
         result <- query(key, param, ...)
         if (!length(result)) {
             return(data.frame(word = word, first_gram = NA, second_gram = NA, mi = NA, 
                 wlmi = NA, stringsAsFactors = FALSE))
         }
         result <- unlist(result)
         return(data.frame(word = word, first_gram = unname(result[names(result) == "gram1"]), 
             second_gram = unname(result[names(result) == "gram2"]), mi = as.numeric(unname(result[names(result) == 
                 "mi"])), wlmi = as.numeric(unname(result[names(result) == "wlmi"])), 
             stringsAsFactors = FALSE))
     })(param = dots[[1L]][[1L]], word = dots[[2L]][[1L]], key = dots[[3L]][[1L]])
  5: query(key, param, ...)
  6: httr::stop_for_status(result)
  
  == testthat results  ===========================================================
  OK: 4 SKIPPED: 0 FAILED: 5
  1. Error: Definition retrieval works (@test_birdnik.R#7) 
  2. Error: Example retrieval works (@test_birdnik.R#21) 
  3. Error: pronounciation retrieval works (@test_birdnik.R#29) 
  4. Error: frequency retrieval works (@test_birdnik.R#37) 
  5. Error: bigram retrieval works (@test_birdnik.R#44) 
  
  Error: testthat unit tests failed
  Execution halted