Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlganz committed Oct 22, 2017
1 parent 9ebc3c5 commit 51d26fb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/testthat/test-1-login.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ test_that("Environmental vars exist", {

test_that("Login works doesn't error", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_silent(login <<- docu_login(demo = TRUE))
})

test_that("An actual account is returned", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(nrow(login)>0)
})
6 changes: 5 additions & 1 deletion tests/testthat/test-2-signing.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ context("Test docuSign envelope and URL for signing")

test_that("Retrieve envelope without error for signing", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
login <<- docu_login(demo = TRUE)
template_id <<- docu_templates(base_url = login[1, 3])$templateId
expect_silent(envelope <<- docu_envelope(
Expand All @@ -21,11 +22,13 @@ test_that("Retrieve envelope without error for signing", {

test_that("envelopId is returned", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(!is.null(envelope$envelopeId))
})

test_that("Embed doesn't error", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_silent(URL <<- docu_embedded_sign(
base_url = login[1, 3],
return_url = "https://www.google.com",
Expand All @@ -37,7 +40,8 @@ test_that("Embed doesn't error", {
})

test_that("URL is legit", {
# skip_on_cran()
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(!httr::http_error(URL))
})

4 changes: 4 additions & 0 deletions tests/testthat/test-3-sending.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ context("Test docuSign envelope and URL for sending")

test_that("Retrieve envelope without error for signing", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
login <<- docu_login(demo = TRUE)
template_id <<- docu_templates(base_url = login[1, 3])$templateId
expect_silent(envelope <<- docu_envelope(
Expand All @@ -21,11 +22,13 @@ test_that("Retrieve envelope without error for signing", {

test_that("uri is returned", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(!is.null(envelope$uri))
})

test_that("Embed doesn't error", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_silent(URL <<- docu_embedded_send(
base_url = login[1, 3],
return_url = "https://www.google.com",
Expand All @@ -38,5 +41,6 @@ test_that("Embed doesn't error", {

test_that("URL is legit", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(!httr::http_error(URL))
})
3 changes: 3 additions & 0 deletions tests/testthat/test-4-envelope.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ context("Test that we can get info about envelopes")

test_that("We can list envelopes without error", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
login <<- docu_login(demo = TRUE)
expect_silent(envelopes <<- docu_list_envelopes(base_url = login$baseUrl[1], from_date = "2017/1/1"))
})

test_that("Envelopes actually exist", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(nrow(envelopes)>0)
expect_true("envelopeId" %in% names(envelopes))
})

test_that("Get status of individual envelope", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_silent(status <<- docu_envelope_status(base_url = login$baseUrl[1], envelope_id = envelopes$envelopeId[1]))
expect_true(length(status) == 1)
})
2 changes: 2 additions & 0 deletions tests/testthat/test-5-download.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ context("Test docu_download")

test_that("Retrieve document without error", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
login <- docu_login(demo = TRUE)
envelopes <- docu_list_envelopes(base_url = login$baseUrl[1], from_date = "2017/1/1")
envelope_id <- envelopes[envelopes$status == "completed","envelopeId"][1]
Expand All @@ -13,5 +14,6 @@ test_that("Retrieve document without error", {

test_that("Document exists", {
skip_on_cran()
skip_if_not(nchar(Sys.getenv("docuSign_integrator_key")) > 0)
expect_true(file.exists(document))
})

0 comments on commit 51d26fb

Please sign in to comment.