-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Better error handling when account is not correct (#79)
- Loading branch information
Showing
6 changed files
with
176 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ func TestCacheAccessTokenV0(t *testing.T) { | |
client.accessTokenGetter = client.getAccessToken | ||
var err error | ||
for i := 0; i < 3; i++ { | ||
_, err = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
_, err, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
if err != nil { | ||
t.Errorf("Did not expect an error %s", err) | ||
} | ||
|
@@ -75,7 +75,7 @@ func TestRefreshTokenOn401V0(t *testing.T) { | |
BaseClient{ClientID: "[email protected]", ClientSecret: "password", ApiEndpoint: server.URL, UserAgent: "userAgent"}, | ||
} | ||
client.accessTokenGetter = client.getAccessToken | ||
_, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
_, _, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
|
||
if getCachedAccessToken("[email protected]", server.URL) != "aMysteriousToken" { | ||
t.Errorf("Did not fetch missing token") | ||
|
@@ -112,10 +112,10 @@ func TestFetchTokenWhenExpiredV0(t *testing.T) { | |
BaseClient{ClientID: "[email protected]", ClientSecret: "password", ApiEndpoint: server.URL, UserAgent: "userAgent"}, | ||
} | ||
client.accessTokenGetter = client.getAccessToken | ||
_, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
_, _, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
// Waiting for the token to get expired | ||
time.Sleep(2 * time.Millisecond) | ||
_, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
_, _, _ = client.request(context.TODO(), "GET", server.URL, nil, "") | ||
|
||
token, _ := getAccessTokenUsernamePassword("[email protected]", "", server.URL, "") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters