Skip to content

Commit

Permalink
Skip tests on CRAN as they use api token.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Oct 15, 2024
1 parent 4451c10 commit 5f28318
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/testthat/test-set_host.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
test_gitstats <- create_gitstats()

test_that("Set connection returns appropriate messages", {
skip_on_cran()
expect_snapshot(
set_github_host(
gitstats_obj = test_gitstats,
Expand All @@ -17,6 +18,7 @@ test_that("Set connection returns appropriate messages", {
})

test_that("When empty token for GitHub, GitStats pulls default token", {
skip_on_cran()
expect_snapshot(
test_gitstats <- create_gitstats() %>%
set_github_host(
Expand All @@ -26,6 +28,7 @@ test_that("When empty token for GitHub, GitStats pulls default token", {
})

test_that("When empty token for GitLab, GitStats pulls default token", {
skip_on_cran()
expect_snapshot(
withr::with_envvar(new = c("GITLAB_PAT" = Sys.getenv("GITLAB_PAT_PUBLIC")), {
test_gitstats <- create_gitstats() %>%
Expand All @@ -37,6 +40,7 @@ test_that("When empty token for GitLab, GitStats pulls default token", {
})

test_that("Set GitHub host with particular repos vector instead of orgs", {
skip_on_cran()
test_gitstats <- create_gitstats()
expect_snapshot(
test_gitstats %>%
Expand All @@ -52,6 +56,7 @@ test_that("Set GitHub host with particular repos vector instead of orgs", {
})

test_that("Set GitLab host with particular repos vector instead of orgs", {
skip_on_cran()
test_gitstats <- create_gitstats()
expect_snapshot(
test_gitstats %>%
Expand All @@ -67,6 +72,7 @@ test_that("Set GitLab host with particular repos vector instead of orgs", {
})

test_that("Set host prints error when repos and orgs are defined and host is not passed to GitStats", {
skip_on_cran()
test_gitstats <- create_gitstats()
expect_snapshot_error(
test_gitstats %>%
Expand All @@ -83,6 +89,7 @@ test_that("Set host prints error when repos and orgs are defined and host is not
})

test_that("Error shows if organizations are not specified and host is not passed", {
skip_on_cran()
test_gitstats <- create_gitstats()
expect_snapshot_error(
test_gitstats %>%
Expand All @@ -97,6 +104,7 @@ test_that("Error shows if organizations are not specified and host is not passed
})

test_that("Error shows, when wrong input is passed when setting connection and host is not passed", {
skip_on_cran()
test_gitstats <- create_gitstats()
expect_snapshot_error(
set_gitlab_host(
Expand All @@ -117,8 +125,8 @@ test_that("Error shows, when wrong input is passed when setting connection and h
})

test_that("Error pops out, when two clients of the same url api are passed as input", {
skip_on_cran()
test_gitstats <- create_gitstats()

expect_snapshot(
error = TRUE,
test_gitstats %>%
Expand All @@ -134,6 +142,7 @@ test_that("Error pops out, when two clients of the same url api are passed as in
})

test_that("Error pops out when `org` does not exist", {
skip_on_cran()
expect_snapshot({
test_gitstats <- create_gitstats() %>%
set_github_host(
Expand Down

0 comments on commit 5f28318

Please sign in to comment.