mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-26 21:36:31 +02:00
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.
33 lines
744 B
Go
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)
|
|
}
|
|
}
|