(t *testing.T)
| 3 | import "testing" |
| 4 | |
| 5 | func 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 | } |
nothing calls this directly
no test coverage detected