MCPcopy Index your code
hub / github.com/google/go-github / TestSanitizeURL

Function TestSanitizeURL

github/github_test.go:3241–3262  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3239}
3240
3241func TestSanitizeURL(t *testing.T) {
3242 t.Parallel()
3243 tests := []struct {
3244 in, want string
3245 }{
3246 {"/?a=b", "/?a=b"},
3247 {"/?a=b&client_secret=secret", "/?a=b&client_secret=REDACTED"},
3248 {"/?a=b&client_id=id&client_secret=secret", "/?a=b&client_id=id&client_secret=REDACTED"},
3249 {"/?a=b&access_token=secret", "/?a=b&access_token=REDACTED"},
3250 {"/?a=b&token=secret", "/?a=b&token=REDACTED"},
3251 {"/?client_secret=s&access_token=t&token=u", "/?access_token=REDACTED&client_secret=REDACTED&token=REDACTED"},
3252 }
3253
3254 for _, tt := range tests {
3255 inURL, _ := url.Parse(tt.in)
3256 want, _ := url.Parse(tt.want)
3257
3258 if got := sanitizeURL(inURL); !cmp.Equal(got, want) {
3259 t.Errorf("sanitizeURL(%v) returned %v, want %v", tt.in, got, want)
3260 }
3261 }
3262}
3263
3264func TestCheckResponse(t *testing.T) {
3265 t.Parallel()

Callers

nothing calls this directly

Calls 2

sanitizeURLFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…