summaryrefslogtreecommitdiff
path: root/internal/hexaicli/run_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaicli/run_test.go')
-rw-r--r--internal/hexaicli/run_test.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/hexaicli/run_test.go b/internal/hexaicli/run_test.go
index dfde068..991965e 100644
--- a/internal/hexaicli/run_test.go
+++ b/internal/hexaicli/run_test.go
@@ -125,12 +125,20 @@ func TestRunWithClient_ErrorPrint(t *testing.T) {
func TestRun_OpenAI_NoKey_ShowsError(t *testing.T) {
dir := testingTempDir(t)
- // write config with provider=openai
- writeTOML(t, filepath.Join(dir, "hexai", "config.toml"), map[string]string{"provider": "openai", "openai_model": "gpt-x"})
+ // write config with provider=openai using sectioned tables
+ configPath := filepath.Join(dir, "hexai", "config.toml")
+ writeConfigString(t, configPath, `
+[provider]
+name = "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", "")
+ t.Setenv("HEXAI_PROVIDER", "")
var out, errb bytes.Buffer
// Run expects parsed flags; here args irrelevant
err := Run(context.Background(), []string{"hello"}, strings.NewReader(""), &out, &errb)