MCPcopy Create free account
hub / github.com/github/gh-aw / TestCodexEngineHasSecretValidation

Function TestCodexEngineHasSecretValidation

pkg/workflow/secret_validation_test.go:200–230  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func TestCodexEngineHasSecretValidation(t *testing.T) {
201 engine := NewCodexEngine()
202 workflowData := &WorkflowData{}
203
204 // Secret validation is now returned by GetSecretValidationStep (not GetInstallationSteps)
205 step := engine.GetSecretValidationStep(workflowData)
206 if len(step) == 0 {
207 t.Fatal("Expected a non-empty secret validation step")
208 }
209
210 stepContent := strings.Join(step, "\n")
211 if !strings.Contains(stepContent, "Validate CODEX_API_KEY or OPENAI_API_KEY secret") {
212 t.Error("Secret validation step should validate CODEX_API_KEY or OPENAI_API_KEY secret")
213 }
214
215 // Should check for both secrets
216 if !strings.Contains(stepContent, "CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}") {
217 t.Error("Secret validation step should reference secrets.CODEX_API_KEY")
218 }
219 if !strings.Contains(stepContent, "OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}") {
220 t.Error("Secret validation step should reference secrets.OPENAI_API_KEY")
221 }
222
223 // Should call the validate_multi_secret.sh script with both secret names
224 if !strings.Contains(stepContent, "${RUNNER_TEMP}/gh-aw/actions/validate_multi_secret.sh") {
225 t.Error("Should call validate_multi_secret.sh script")
226 }
227 if !strings.Contains(stepContent, "CODEX_API_KEY OPENAI_API_KEY") {
228 t.Error("Should pass both CODEX_API_KEY and OPENAI_API_KEY to the script")
229 }
230}
231
232func TestGenerateMultiSecretValidationStepWithEnvOverrides(t *testing.T) {
233 t.Run("override replaces default secret expression", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewCodexEngineFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected