(t *testing.T)
| 529 | } |
| 530 | |
| 531 | func TestGitService_GetRef_pathEscape(t *testing.T) { |
| 532 | t.Parallel() |
| 533 | client, mux, _ := setup(t) |
| 534 | |
| 535 | mux.HandleFunc("/repos/o/r/git/ref/heads/b", func(w http.ResponseWriter, r *http.Request) { |
| 536 | testMethod(t, r, "GET") |
| 537 | if strings.Contains(r.URL.RawPath, "%2F") { |
| 538 | t.Errorf("RawPath still contains escaped / as %%2F: %v", r.URL.RawPath) |
| 539 | } |
| 540 | fmt.Fprint(w, ` |
| 541 | { |
| 542 | "ref": "refs/heads/b", |
| 543 | "url": "https://api.github.com/repos/o/r/git/refs/heads/b", |
| 544 | "object": { |
| 545 | "type": "commit", |
| 546 | "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd", |
| 547 | "url": "https://api.github.com/repos/o/r/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" |
| 548 | } |
| 549 | }`) |
| 550 | }) |
| 551 | |
| 552 | ctx := t.Context() |
| 553 | _, _, err := client.Git.GetRef(ctx, "o", "r", "refs/heads/b") |
| 554 | if err != nil { |
| 555 | t.Fatalf("Git.GetRef returned error: %v", err) |
| 556 | } |
| 557 | |
| 558 | const methodName = "GetRef" |
| 559 | testBadOptions(t, methodName, func() (err error) { |
| 560 | _, _, err = client.Git.GetRef(ctx, "\n", "\n", "\n") |
| 561 | return err |
| 562 | }) |
| 563 | |
| 564 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 565 | got, resp, err := client.Git.GetRef(ctx, "o", "r", "refs/heads/b") |
| 566 | if got != nil { |
| 567 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 568 | } |
| 569 | return resp, err |
| 570 | }) |
| 571 | } |
| 572 | |
| 573 | func TestGitService_UpdateRef_pathEscape(t *testing.T) { |
| 574 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…