zot/internal/auth/store_additional_test.go
patriceckhart 3364159201 Add expanded login provider support
Add GitHub Copilot subscription login and broaden API-key login to all catalog providers.

Persist credentials for additional API-key providers, include them in model filtering and logout, and fix clearing those stored credentials.

Improve provider/model/slash pickers with pagination and clearer credential-state labels.
2026-05-24 11:08:09 +02:00

33 lines
744 B
Go

package auth
import (
"path/filepath"
"testing"
)
func TestStoreAdditionalAPIKeyClear(t *testing.T) {
store := NewStore(filepath.Join(t.TempDir(), "auth.json"))
if err := store.SetAPIKey("groq", "gsk_test"); err != nil {
t.Fatal(err)
}
creds, err := store.Load()
if err != nil {
t.Fatal(err)
}
if got := creds.Method("groq"); got != "apikey" {
t.Fatalf("method before clear=%q", got)
}
if err := store.Clear("groq"); err != nil {
t.Fatal(err)
}
creds, err = store.Load()
if err != nil {
t.Fatal(err)
}
if got := creds.Method("groq"); got != "" {
t.Fatalf("method after clear=%q", got)
}
if len(creds.AdditionalAPIKeyCreds) != 0 {
t.Fatalf("additional creds not cleared: %+v", creds.AdditionalAPIKeyCreds)
}
}