MCPcopy Index your code
hub / github.com/github/gh-aw / TestSanitizeErrorMessage_GhAwVariables

Function TestSanitizeErrorMessage_GhAwVariables

pkg/stringutil/sanitize_test.go:210–249  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

208}
209
210func TestSanitizeErrorMessage_GhAwVariables(t *testing.T) {
211 tests := []struct {
212 name string
213 message string
214 expected string
215 }{
216 {
217 name: "GH_AW_SKIP_NPX_VALIDATION not redacted",
218 message: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true",
219 expected: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true",
220 },
221 {
222 name: "GH_AW_SKIP_UV_VALIDATION not redacted",
223 message: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true",
224 expected: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true",
225 },
226 {
227 name: "GH_AW_SKIP_PIP_VALIDATION not redacted",
228 message: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true",
229 expected: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true",
230 },
231 {
232 name: "generic GH_AW prefix not redacted",
233 message: "Set GH_AW_SOME_OPTION to configure this feature",
234 expected: "Set GH_AW_SOME_OPTION to configure this feature",
235 },
236 {
237 name: "non-GH_AW still redacted",
238 message: "Error accessing MY_SECRET_KEY",
239 expected: "Error accessing [REDACTED]",
240 },
241 }
242
243 for _, tt := range tests {
244 t.Run(tt.name, func(t *testing.T) {
245 result := SanitizeErrorMessage(tt.message)
246 assertSanitizeResult(t, "SanitizeErrorMessage", tt.message, result, tt.expected)
247 })
248 }
249}
250
251func TestSanitizeErrorMessage_RealWorldExamples(t *testing.T) {
252 tests := []struct {

Callers

nothing calls this directly

Calls 3

SanitizeErrorMessageFunction · 0.85
assertSanitizeResultFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected