Skip to content

Commit

Permalink
Ref ixpantia#22 testing missing credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnyhdez committed Mar 14, 2020
1 parent fded31d commit 0508011
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/get_pipeline_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ get_pipeline_report <- function(user_code, api_token, pipelineid) {
warning("Please add a valid API token")
} else if (missing(pipelineid)) {
warning("Please add a valid pipeline ID")
} else
} else {

tryCatch(
{
r <- get_request(user_code = user_code,
Expand Down Expand Up @@ -68,5 +69,6 @@ get_pipeline_report <- function(user_code, api_token, pipelineid) {
-result_website, -result_contact_custom_fields)

return(contenido)
}
}

24 changes: 24 additions & 0 deletions tests/testthat/test-error-warning-msg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
context("Error and warning messages")

testthat::test_that("Invalid credentials", {
expect_warning(
get_pipeline_report(api_token = "96066",
pipelineid = "57102821"),
"Please add a valid user code"
)

expect_warning(
get_pipeline_report(user_code = "6A6E88",
pipelineid = "57102821"),
"Please add a valid API token"
)

expect_warning(
get_pipeline_report(user_code = "6A6E88",
api_token = "96066"),
"Please add a valid pipeline ID"
)
})



0 comments on commit 0508011

Please sign in to comment.