Add projects

This commit is contained in:
Alois 2026-08-24 00:10:41 +02:00
commit 8b607dd700
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
1802 changed files with 503346 additions and 2 deletions

View file

@ -0,0 +1,43 @@
package auth
import "testing"
func TestIsConfigAPIKeyAuth(t *testing.T) {
if IsConfigAPIKeyAuth(nil) {
t.Fatal("expected nil auth to be false")
}
if IsConfigAPIKeyAuth(&Auth{Attributes: map[string]string{"source": "config:codex[x]"}}) {
t.Fatal("expected missing auth_kind and api_key to be false")
}
if IsConfigAPIKeyAuth(&Auth{
ID: "codex:oauth:abc",
Provider: "codex",
Attributes: map[string]string{
"auth_kind": "oauth",
"api_key": "k",
"source": "config:codex[abc]",
},
}) {
t.Fatal("expected explicit oauth auth to be false")
}
if !IsConfigAPIKeyAuth(&Auth{
ID: "codex:apikey:abc",
Provider: "codex",
Attributes: map[string]string{
"auth_kind": "apikey",
"source": "config:codex[abc]",
},
}) {
t.Fatal("expected empty api_key with auth_kind=apikey and config source to be true")
}
if !IsConfigAPIKeyAuth(&Auth{
ID: "codex:apikey:abc",
Provider: "codex",
Attributes: map[string]string{
"api_key": "k",
"source": "config:codex[abc]",
},
}) {
t.Fatal("expected config api key auth")
}
}