Skip to content

Commit

Permalink
Codefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed Sep 5, 2024
1 parent 31a4874 commit 776e052
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test-location-packit.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ test_that("can authenticate with existing token", {
clear_auth_cache()
withr::defer(clear_auth_cache())

token = "my-github-token"
token <- "my-github-token"

mock_post <- local_mock_response(
to_json(list(token = jsonlite::unbox("my-packit-token"))),
Expand All @@ -22,7 +22,7 @@ test_that("can authenticate with existing token", {
expect_equal(args[[1]]$url, "http://example.com/packit/api/auth/login/api")
expect_equal(args[[1]]$body$data, list(token = scalar("my-github-token")))
expect_equal(args[[1]]$body$type, "json")

## And a second time, does not call mock_post again:
res2 <- expect_silent(
packit_authorisation("http://example.com/", token))
Expand All @@ -42,7 +42,7 @@ test_that("can authenticate using device flow", {
mockery::stub(packit_authorisation, "do_oauth_device_flow", "my-github-token")

res <- evaluate_promise(packit_authorisation("http://example.com/",
token=NULL))
token = NULL))

expect_length(res$messages, 2)
expect_match(res$messages[[1]], "Logging in to http://example.com")
Expand All @@ -61,7 +61,7 @@ test_that("location_packit uses authentication", {
clear_auth_cache()
withr::defer(clear_auth_cache())

token = "my-github-token"
token <- "my-github-token"
id <- outpack_id()
metadata <- "packet metadata"

Expand Down Expand Up @@ -90,7 +90,7 @@ test_that("location_packit uses authentication", {
args <- mockery::mock_args(mock)[[2]]
expect_match(args[[1]]$url,
"http://example.com/packit/api/outpack/metadata/.*/text")
expect_equal(args[[1]]$headers,
expect_equal(args[[1]]$headers,
list(Authorization = "Bearer my-packit-token"),
ignore_attr = TRUE)

Expand Down

0 comments on commit 776e052

Please sign in to comment.