Skip to content

Commit

Permalink
fix unit tests for helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
nanjiangshu committed Sep 3, 2024
1 parent f204e47 commit 678d8ba
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 382 deletions.
6 changes: 3 additions & 3 deletions sda-admin/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ func CheckTokenExpiration(accessToken string) error {

switch untilExp := time.Until(expiration); {
case untilExp < 0:
return fmt.Errorf("# the provided access token has expired, please renew it")
return fmt.Errorf("the provided access token has expired, please renew it")
case untilExp > 0 && untilExp < 24*time.Hour:
fmt.Fprintln(
os.Stderr,
"# The provided access token expires in",
"The provided access token expires in",
time.Until(expiration).Truncate(time.Second),
)
fmt.Fprintln(os.Stderr, "Consider renewing the token.")
default:
fmt.Fprintln(
os.Stderr,
"# The provided access token expires in",
"The provided access token expires in",
time.Until(expiration).Truncate(time.Second),
)
}
Expand Down
Loading

0 comments on commit 678d8ba

Please sign in to comment.