tests/testthat/test-06-epost.R

# Test epost() -----------------------------------------------------------

context("Testing 'epost()'")

if (getOption('reutils.test.remote')) {
  uids <- esearch("Chlamydia", "bioproject", retmax = 20)
  
  test_that("epost() works with 'esearch' objects", {
    p1 <- epost(uids)
    expect_is(p1, 'epost')
    expect_match(webenv(p1), "^MCID_.+")
    expect_equal(querykey(p1), 1)
  })
  
  test_that("epost() works with 'entrez_uid' objects", {
    p2 <- epost(content(uids, 'parsed'))
    expect_is(p2, 'epost')
    expect_match(webenv(p2), "^MCID_.+")
    expect_equal(querykey(p2), 1)
  })
  
  test_that("epost() works with character/numeric vectors", {
    p3 <- epost(c("194680922", "50978626", "28558982", "9507199", "6678417"), "protein")
    expect_match(webenv(p3), "^MCID_.+")
    expect_equal(querykey(p3), 1)
  })
}
gschofl/reutils documentation built on Oct. 9, 2020, 9:42 p.m.