(reg *httpmock.Registry, accept, diff string)
| 506 | } |
| 507 | |
| 508 | func stubDiffRequest(reg *httpmock.Registry, accept, diff string) { |
| 509 | reg.Register( |
| 510 | func(req *http.Request) bool { |
| 511 | if !strings.EqualFold(req.Method, "GET") { |
| 512 | return false |
| 513 | } |
| 514 | if req.URL.EscapedPath() != "/repos/OWNER/REPO/pulls/123" { |
| 515 | return false |
| 516 | } |
| 517 | return req.Header.Get("Accept") == accept |
| 518 | }, |
| 519 | func(req *http.Request) (*http.Response, error) { |
| 520 | return &http.Response{ |
| 521 | StatusCode: 200, |
| 522 | Request: req, |
| 523 | Body: io.NopCloser(strings.NewReader(diff)), |
| 524 | }, nil |
| 525 | }) |
| 526 | } |
| 527 | |
| 528 | func Test_filterDiff(t *testing.T) { |
| 529 | rawDiff := fmt.Sprintf(testDiff, "", "", "", "") |
no test coverage detected