summaryrefslogtreecommitdiff
path: root/internal/oauth/oauth_test.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-04-17 11:31:52 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commit9cb79f0ca4cf6ba52bbb573c22778c005edf1ee7 (patch)
tree815a1f6bae144f24f375af4e1e699ef6cc7998ea /internal/oauth/oauth_test.go
parent188d64d6cf018e410b02714d3125de15aa8ce928 (diff)
OAuth Token: Set previous refresh token if new refresh token is empty
This is for 2.x servers that return an empty refresh token after refreshing
Diffstat (limited to 'internal/oauth/oauth_test.go')
-rw-r--r--internal/oauth/oauth_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/oauth/oauth_test.go b/internal/oauth/oauth_test.go
index 60ce5c7..1f2a29e 100644
--- a/internal/oauth/oauth_test.go
+++ b/internal/oauth/oauth_test.go
@@ -81,7 +81,7 @@ func Test_accessToken(t *testing.T) {
// Set the tokens as expired
o.SetTokenExpired()
- // We should not get an error because expired and no refresh token
+ // We should get an error because expired and no refresh token
_, err = o.AccessToken(context.Background())
if err == nil {
t.Fatal("Got no error when getting access token on non-empty structure and expired")
@@ -116,7 +116,7 @@ func Test_accessToken(t *testing.T) {
// Now let's act like a 2.x server, we give no refresh token back. When we refresh the previous refresh token should be gotten
o.token.t.Refresh = refresh
prevRefresh := refresh
- o.token.t.Refresher = func(refreshToken string) (*TokenResponse, time.Time, error) {
+ o.token.t.Refresher = func(ctx context.Context, refreshToken string) (*TokenResponse, time.Time, error) {
if refreshToken != refresh {
t.Fatalf("Passed refresh token to refresher not equal to updated refresh token, got: %v, want: %v", refreshToken, refresh)
}
@@ -125,7 +125,7 @@ func Test_accessToken(t *testing.T) {
return r, expired, nil
}
- got, err = o.AccessToken()
+ got, err = o.AccessToken(context.Background())
if err != nil {
t.Fatalf("Got error when getting access token on non-empty expired structure and with an empty refresh response: %v", err)
}