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

Function TestGetRequiredSecretsForEngineAttributes

pkg/cli/engine_secrets_test.go:113–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

111}
112
113func TestGetRequiredSecretsForEngineAttributes(t *testing.T) {
114 t.Run("copilot secret has correct attributes", func(t *testing.T) {
115 requirements := getSecretRequirementsForEngine(string(constants.CopilotEngine), false, false)
116 require.Len(t, requirements, 1, "Should have exactly one requirement")
117
118 req := requirements[0]
119 assert.Equal(t, "COPILOT_GITHUB_TOKEN", req.Name, "Secret name should match")
120 assert.True(t, req.IsEngineSecret, "Should be marked as engine secret")
121 assert.Equal(t, string(constants.CopilotEngine), req.EngineName, "Engine name should match")
122 assert.False(t, req.Optional, "Copilot token should be required")
123 assert.NotEmpty(t, req.KeyURL, "Should have a key URL")
124 assert.NotEmpty(t, req.Description, "Should have a description")
125 })
126
127 t.Run("claude secret has no alternative env vars", func(t *testing.T) {
128 requirements := getSecretRequirementsForEngine(string(constants.ClaudeEngine), false, false)
129 require.Len(t, requirements, 1, "Should have exactly one requirement")
130
131 req := requirements[0]
132 assert.Equal(t, "ANTHROPIC_API_KEY", req.Name, "Secret name should match")
133 assert.Empty(t, req.AlternativeEnvVars, "Should have no alternative env vars")
134 })
135
136 t.Run("system secrets are not engine secrets", func(t *testing.T) {
137 requirements := getSecretRequirementsForEngine("", true, true)
138
139 for _, req := range requirements {
140 if req.Name == "GH_AW_GITHUB_TOKEN" {
141 assert.False(t, req.IsEngineSecret, "System secret should not be marked as engine secret")
142 assert.Empty(t, req.EngineName, "System secret should have empty engine name")
143 }
144 }
145 })
146}
147
148func TestStringContainsSecretName(t *testing.T) {
149 tests := []struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected