-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Laura Brehm <[email protected]>
- Loading branch information
Showing
23 changed files
with
447 additions
and
155 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,13 +286,14 @@ func TestErase(t *testing.T) { | |
t.Run("official registry", func(t *testing.T) { | ||
f := newStore(map[string]types.AuthConfig{ | ||
registry.IndexServer: { | ||
Email: "[email protected]", | ||
Email: "[email protected]", | ||
Password: validNotExpiredToken + "..refresh-token", | ||
}, | ||
}) | ||
var logoutCalled bool | ||
var revokedToken string | ||
manager := &testManager{ | ||
logout: func() error { | ||
logoutCalled = true | ||
logout: func(token string) error { | ||
revokedToken = token | ||
return nil | ||
}, | ||
} | ||
|
@@ -304,7 +305,7 @@ func TestErase(t *testing.T) { | |
assert.NilError(t, err) | ||
|
||
assert.Check(t, is.Len(f.GetAuthConfigs(), 0)) | ||
assert.Check(t, logoutCalled) | ||
assert.Equal(t, revokedToken, "refresh-token") | ||
}) | ||
|
||
t.Run("different registry", func(t *testing.T) { | ||
|
@@ -388,16 +389,16 @@ func TestStore(t *testing.T) { | |
|
||
type testManager struct { | ||
loginDevice func() (oauth.TokenResult, error) | ||
logout func() error | ||
logout func(token string) error | ||
refresh func(token string) (oauth.TokenResult, error) | ||
} | ||
|
||
func (m *testManager) LoginDevice(_ context.Context, _ io.Writer) (oauth.TokenResult, error) { | ||
return m.loginDevice() | ||
} | ||
|
||
func (m *testManager) Logout(_ context.Context) error { | ||
return m.logout() | ||
func (m *testManager) Logout(_ context.Context, token string) error { | ||
return m.logout(token) | ||
} | ||
|
||
func (m *testManager) RefreshToken(_ context.Context, token string) (oauth.TokenResult, error) { | ||
|
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
Oops, something went wrong.