diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-04 08:54:18 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-04 08:54:18 +0300 |
| commit | 9b5ce6a6ffc8d9ff10ae8d2c384efd91de8d2b76 (patch) | |
| tree | 4711f887c03e20fab9a334962238c53ec6046941 /internal/hexaicli | |
| parent | 28945db47e13b3de8345ee1cc0c8dece1d9a4e0e (diff) | |
tests: fix hexaicli OpenAI-key dependent tests; add lsp code action and helper tests; ignore coverage artifacts
Diffstat (limited to 'internal/hexaicli')
| -rw-r--r-- | internal/hexaicli/run_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/hexaicli/run_test.go b/internal/hexaicli/run_test.go index 3fe59fb..69fe089 100644 --- a/internal/hexaicli/run_test.go +++ b/internal/hexaicli/run_test.go @@ -87,6 +87,9 @@ func TestRun_OpenAI_NoKey_ShowsError(t *testing.T) { // write config with provider=openai writeJSON(t, filepath.Join(dir, "hexai", "config.json"), map[string]any{"provider":"openai", "openai_model":"gpt-x"}) t.Setenv("XDG_CONFIG_HOME", dir) + // Ensure no OpenAI API key is present in environment + t.Setenv("HEXAI_OPENAI_API_KEY", "") + t.Setenv("OPENAI_API_KEY", "") var out, errb bytes.Buffer // Run expects parsed flags; here args irrelevant err := Run(context.Background(), []string{"hello"}, strings.NewReader(""), &out, &errb) @@ -110,6 +113,8 @@ func TestNewClientFromConfig_Ollama(t *testing.T) { func TestNewClientFromConfig_OpenAI_MissingKey(t *testing.T) { cfg := appconfig.App{ Provider: "openai", OpenAIBaseURL: "https://api", OpenAIModel: "gpt" } + t.Setenv("HEXAI_OPENAI_API_KEY", "") + t.Setenv("OPENAI_API_KEY", "") if _, err := newClientFromConfig(cfg); err == nil { t.Fatalf("expected error for missing openai key") } |
