MCPcopy Create free account
hub / github.com/google/go-github / TestRepositoriesService_GetCommitRaw_patch

Function TestRepositoriesService_GetCommitRaw_patch

github/repos_commits_test.go:198–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

196}
197
198func TestRepositoriesService_GetCommitRaw_patch(t *testing.T) {
199 t.Parallel()
200 client, mux, _ := setup(t)
201
202 const rawStr = "@@patch content"
203
204 mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
205 testMethod(t, r, "GET")
206 testHeader(t, r, "Accept", mediaTypeV3Patch)
207 fmt.Fprint(w, rawStr)
208 })
209
210 ctx := t.Context()
211 got, _, err := client.Repositories.GetCommitRaw(ctx, "o", "r", "s", RawOptions{Type: Patch})
212 if err != nil {
213 t.Fatalf("Repositories.GetCommitRaw returned error: %v", err)
214 }
215 want := rawStr
216 if got != want {
217 t.Errorf("Repositories.GetCommitRaw returned %v want %v", got, want)
218 }
219}
220
221func TestRepositoriesService_GetCommitRaw_invalid(t *testing.T) {
222 t.Parallel()

Callers

nothing calls this directly

Calls 4

testMethodFunction · 0.85
testHeaderFunction · 0.85
GetCommitRawMethod · 0.80
setupFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…