tests/testthat/test_lookup_statuses.R

context("lookup_statuses")

test_that("lookup_statuses returns users data", {
  skip_on_cran()

  n <- 2
  token <- readRDS("twitter_tokens")
  x <- lookup_statuses(c("558115838503690243",
                         "760182486005583872",
                         "776053079540166657"),
                       token = token)

  expect_equal(is.data.frame(x), TRUE)
  expect_named(x)
  expect_true("status_id" %in% names(x))
  expect_equal(nrow(x), n)
  expect_gt(ncol(x), 15)
  expect_true(all(c("friends_count", "statuses_count") %in% names(x)))
  #expect_true(is.data.frame(attr(x, "users")))
  #expect_true(is.data.frame(users_data(x)))
  #expect_gt(nrow(users_data(x)), 0)
  #expect_gt(ncol(users_data(x)), 15)
  #expect_named(users_data(x))
})

Try the rtweet package in your browser

Any scripts or data that you put into this service are public.

rtweet documentation built on Jan. 11, 2020, 9:11 a.m.