(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestResolveAuthProvider_StoreAPIKey(t *testing.T) { |
| 90 | withTempStore(t) |
| 91 | cred := &AuthProfileCredential{ |
| 92 | CredType: CredentialAPIKey, |
| 93 | Provider: ProviderOpenAI, |
| 94 | Key: "sk-test", |
| 95 | Email: "u@example.com", |
| 96 | } |
| 97 | if err := UpsertProfile("openai:test", cred, zap.NewNop()); err != nil { |
| 98 | t.Fatalf("UpsertProfile: %v", err) |
| 99 | } |
| 100 | |
| 101 | tp, err := ResolveAuthProvider(context.Background(), ProviderOpenAI, zap.NewNop()) |
| 102 | if err != nil { |
| 103 | t.Fatalf("ResolveAuthProvider: %v", err) |
| 104 | } |
| 105 | defer tp.Close() |
| 106 | if tp.Mode() != AuthModeAPIKey { |
| 107 | t.Errorf("mode = %q, want api-key", tp.Mode()) |
| 108 | } |
| 109 | if tp.Email() != "u@example.com" { |
| 110 | t.Errorf("email = %q, want u@example.com", tp.Email()) |
| 111 | } |
| 112 | tok, _ := tp.Token(context.Background()) |
| 113 | if tok != "sk-test" { |
| 114 | t.Errorf("token = %q, want sk-test", tok) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | func TestResolveAuthProvider_StoreToken(t *testing.T) { |
| 119 | withTempStore(t) |
nothing calls this directly
no test coverage detected