Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
43
backend/sdk/cliproxy/auth/config_apikey_test.go
Normal file
43
backend/sdk/cliproxy/auth/config_apikey_test.go
Normal 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")
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue