MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestIsConfigAPIKeyAuth

Function TestIsConfigAPIKeyAuth

sdk/cliproxy/auth/config_apikey_test.go:5–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestIsConfigAPIKeyAuth(t *testing.T) {
6 if IsConfigAPIKeyAuth(nil) {
7 t.Fatal("expected nil auth to be false")
8 }
9 if IsConfigAPIKeyAuth(&Auth{Attributes: map[string]string{"source": "config:codex[x]"}}) {
10 t.Fatal("expected missing api_key to be false")
11 }
12 if IsConfigAPIKeyAuth(&Auth{
13 ID: "codex:oauth:abc",
14 Provider: "codex",
15 Attributes: map[string]string{
16 "auth_kind": "oauth",
17 "api_key": "k",
18 "source": "config:codex[abc]",
19 },
20 }) {
21 t.Fatal("expected explicit oauth auth to be false")
22 }
23 if !IsConfigAPIKeyAuth(&Auth{
24 ID: "codex:apikey:abc",
25 Provider: "codex",
26 Attributes: map[string]string{
27 "api_key": "k",
28 "source": "config:codex[abc]",
29 },
30 }) {
31 t.Fatal("expected config api key auth")
32 }
33}

Callers

nothing calls this directly

Calls 1

IsConfigAPIKeyAuthFunction · 0.85

Tested by

no test coverage detected