(reg *httpmock.Registry, accept, diff string)
| 438 | } |
| 439 | |
| 440 | func stubDiffRequest(reg *httpmock.Registry, accept, diff string) { |
| 441 | reg.Register( |
| 442 | func(req *http.Request) bool { |
| 443 | if !strings.EqualFold(req.Method, "GET") { |
| 444 | return false |
| 445 | } |
| 446 | if req.URL.EscapedPath() != "/repos/OWNER/REPO/pulls/123" { |
| 447 | return false |
| 448 | } |
| 449 | return req.Header.Get("Accept") == accept |
| 450 | }, |
| 451 | func(req *http.Request) (*http.Response, error) { |
| 452 | return &http.Response{ |
| 453 | StatusCode: 200, |
| 454 | Request: req, |
| 455 | Body: io.NopCloser(strings.NewReader(diff)), |
| 456 | }, nil |
| 457 | }) |
| 458 | } |
| 459 | |
| 460 | func Test_filterDiff(t *testing.T) { |
| 461 | rawDiff := fmt.Sprintf(testDiff, "", "", "", "") |
no test coverage detected