Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit e0ce731

Browse files
committed
add some tests for auth
1 parent fe62328 commit e0ce731

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/testthat/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.httr-oauth

tests/testthat/test-gist_auth.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
test_that("gist_auth finds PAT", {
2+
skip_on_cran()
3+
auth <- gist_auth(reauth = TRUE)
4+
expect_equal(
5+
auth$Authorization,
6+
paste0("token ", gitcreds::gitcreds_get()$password)
7+
)
8+
})
9+
10+
#can't (easily) test PAT stored with gitcreds::gitcreds_set() or interactive oauth
11+
12+
test_that("valid_gh_pat() works", {
13+
expect_false(valid_gh_pat("hello"))
14+
expect_false(valid_gh_pat(""))
15+
expect_false(valid_gh_pat(NULL))
16+
})

0 commit comments

Comments
 (0)