diff --git a/libs/auth/cache/cache.go b/libs/auth/cache/cache.go index 7ca9e8b68..2c88d093f 100644 --- a/libs/auth/cache/cache.go +++ b/libs/auth/cache/cache.go @@ -9,7 +9,7 @@ import ( type TokenCache interface { Store(key string, t *oauth2.Token) error Lookup(key string) (*oauth2.Token, error) - DeleteKey(key string) error + Delete(key string) error } var tokenCache int diff --git a/libs/auth/cache/file.go b/libs/auth/cache/file.go index 9e99070ec..4a7c37814 100644 --- a/libs/auth/cache/file.go +++ b/libs/auth/cache/file.go @@ -73,7 +73,7 @@ func (c *FileTokenCache) Lookup(key string) (*oauth2.Token, error) { return t, nil } -func (c *FileTokenCache) DeleteKey(key string) error { +func (c *FileTokenCache) Delete(key string) error { err := c.load() if errors.Is(err, fs.ErrNotExist) { return ErrNotConfigured diff --git a/libs/auth/cache/file_test.go b/libs/auth/cache/file_test.go index fb7375c29..bd3f84ace 100644 --- a/libs/auth/cache/file_test.go +++ b/libs/auth/cache/file_test.go @@ -118,7 +118,7 @@ func TestStoreAndDeleteKey(t *testing.T) { require.NoError(t, err) l := &FileTokenCache{} - err = l.DeleteKey("x") + err = l.Delete("x") require.NoError(t, err) assert.Equal(t, 1, len(l.Tokens)) @@ -134,7 +134,7 @@ func TestDeleteKeyNotExist(t *testing.T) { c := &FileTokenCache{ Tokens: map[string]*oauth2.Token{}, } - err := c.DeleteKey("x") + err := c.Delete("x") assert.Equal(t, ErrNotConfigured, err) _, err = c.Lookup("x") diff --git a/libs/auth/cache/in_memory.go b/libs/auth/cache/in_memory.go index 6daaf868f..756002e08 100644 --- a/libs/auth/cache/in_memory.go +++ b/libs/auth/cache/in_memory.go @@ -23,8 +23,8 @@ func (i *InMemoryTokenCache) Store(key string, t *oauth2.Token) error { return nil } -// DeleteKey implements TokenCache. -func (i *InMemoryTokenCache) DeleteKey(key string) error { +// Delete implements TokenCache. +func (i *InMemoryTokenCache) Delete(key string) error { _, ok := i.Tokens[key] if !ok { return ErrNotConfigured diff --git a/libs/auth/cache/in_memory_test.go b/libs/auth/cache/in_memory_test.go index 3714ed795..739952317 100644 --- a/libs/auth/cache/in_memory_test.go +++ b/libs/auth/cache/in_memory_test.go @@ -58,7 +58,7 @@ func TestInMemoryDeleteKey(t *testing.T) { }) require.NoError(t, err) - err = c.DeleteKey("x") + err = c.Delete("x") require.NoError(t, err) assert.Equal(t, 1, len(c.Tokens)) @@ -74,7 +74,7 @@ func TestInMemoryDeleteKeyNotExist(t *testing.T) { c := &InMemoryTokenCache{ Tokens: map[string]*oauth2.Token{}, } - err := c.DeleteKey("x") + err := c.Delete("x") assert.Equal(t, ErrNotConfigured, err) _, err = c.Lookup("x") diff --git a/libs/auth/oauth.go b/libs/auth/oauth.go index 46f2af11c..ec615fe71 100644 --- a/libs/auth/oauth.go +++ b/libs/auth/oauth.go @@ -152,7 +152,7 @@ func (a *PersistentAuth) ClearToken(ctx context.Context) error { } // lookup token identified by host (and possibly the account id) key := a.key() - return a.cache.DeleteKey(key) + return a.cache.Delete(key) } func (a *PersistentAuth) init(ctx context.Context) error { diff --git a/libs/auth/oauth_test.go b/libs/auth/oauth_test.go index e5e36032b..fd245c67c 100644 --- a/libs/auth/oauth_test.go +++ b/libs/auth/oauth_test.go @@ -72,7 +72,7 @@ func (m *tokenCacheMock) Lookup(key string) (*oauth2.Token, error) { return m.lookup(key) } -func (m *tokenCacheMock) DeleteKey(key string) error { +func (m *tokenCacheMock) Delete(key string) error { if m.deleteKey == nil { panic("no deleteKey mock") }