Skip to content

Commit

Permalink
set mock Creds to be default values
Browse files Browse the repository at this point in the history
  • Loading branch information
DyfanJones committed Jul 3, 2024
1 parent aede61f commit 6f74bdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion paws.common/R/credential_providers.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ sso_credential_process <- function(sso_session,

check_if_cred_needs_refresh <- function(sso_role_name){
if (!is.null(cred <- cred_refresh_cache[[sso_role_name]])) {
if (!length(expire <- cred$expiration)) expire <- 0
expire <- cred$expiration
if (is.infinite(expire) | !length(expire)) expire <- 0
expiration <- expire / 1000
now <- as.numeric(Sys.time())
return(now > expiration)
Expand Down
4 changes: 2 additions & 2 deletions paws.common/tests/testthat/test_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ test_that("sso_credential_process legacy", {
expiration = "foo_world"
)
))
mock_Creds <- mock2(TRUE)
mock_Creds <- mock2(Creds())
mock_sso <- mock2(list(get_role_credentials = mock_get_role_credentials))
mockery::stub(sso_credential_process, "file.exists", mock_file_exists)
mockery::stub(sso_credential_process, "jsonlite::fromJSON", mock_fromJSON)
Expand Down Expand Up @@ -386,7 +386,7 @@ test_that("sso_credential_process", {
expiration = "foo_world"
)
))
mock_Creds <- mock2(TRUE)
mock_Creds <- mock2(Creds())
mock_sso <- mock2(list(get_role_credentials = mock_get_role_credentials))
mockery::stub(sso_credential_process, "file.exists", mock_file_exists)
mockery::stub(sso_credential_process, "jsonlite::fromJSON", mock_fromJSON)
Expand Down

0 comments on commit 6f74bdc

Please sign in to comment.