make tokenCacheMock consistent naming with struct

This commit is contained in:
Richard Nordström 2024-09-23 21:55:31 +02:00
parent 18d3fea34e
commit 11c37673a6
No known key found for this signature in database
GPG Key ID: ACCB352EC60AF27C
1 changed files with 7 additions and 7 deletions

View File

@ -53,9 +53,9 @@ func TestOidcForWorkspace(t *testing.T) {
}
type tokenCacheMock struct {
store func(key string, t *oauth2.Token) error
lookup func(key string) (*oauth2.Token, error)
deleteKey func(key string) error
store func(key string, t *oauth2.Token) error
lookup func(key string) (*oauth2.Token, error)
delete func(key string) error
}
func (m *tokenCacheMock) Store(key string, t *oauth2.Token) error {
@ -73,10 +73,10 @@ func (m *tokenCacheMock) Lookup(key string) (*oauth2.Token, error) {
}
func (m *tokenCacheMock) Delete(key string) error {
if m.deleteKey == nil {
if m.delete == nil {
panic("no deleteKey mock")
}
return m.deleteKey(key)
return m.delete(key)
}
func TestLoad(t *testing.T) {
@ -246,7 +246,7 @@ func TestClearToken(t *testing.T) {
assert.Equal(t, "https://abc/oidc/accounts/xyz", key)
return &oauth2.Token{}, ErrNotConfigured
},
deleteKey: func(key string) error {
delete: func(key string) error {
assert.Equal(t, "https://abc/oidc/accounts/xyz", key)
return nil
},
@ -269,7 +269,7 @@ func TestClearTokenNotExist(t *testing.T) {
assert.Equal(t, "https://abc/oidc/accounts/xyz", key)
return &oauth2.Token{}, ErrNotConfigured
},
deleteKey: func(key string) error {
delete: func(key string) error {
assert.Equal(t, "https://abc/oidc/accounts/xyz", key)
return ErrNotConfigured
},