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

Function TestRepositoriesService_GetCommitRaw_diff

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

Source from the content-addressed store, hash-verified

159}
160
161func TestRepositoriesService_GetCommitRaw_diff(t *testing.T) {
162 t.Parallel()
163 client, mux, _ := setup(t)
164
165 const rawStr = "@@diff content"
166
167 mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
168 testMethod(t, r, "GET")
169 testHeader(t, r, "Accept", mediaTypeV3Diff)
170 fmt.Fprint(w, rawStr)
171 })
172
173 ctx := t.Context()
174 got, _, err := client.Repositories.GetCommitRaw(ctx, "o", "r", "s", RawOptions{Type: Diff})
175 if err != nil {
176 t.Fatalf("Repositories.GetCommitRaw returned error: %v", err)
177 }
178 want := rawStr
179 if got != want {
180 t.Errorf("Repositories.GetCommitRaw returned %v want %v", got, want)
181 }
182
183 const methodName = "GetCommitRaw"
184 testBadOptions(t, methodName, func() (err error) {
185 _, _, err = client.Repositories.GetCommitRaw(ctx, "\n", "\n", "\n", RawOptions{Type: Diff})
186 return err
187 })
188
189 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
190 got, resp, err := client.Repositories.GetCommitRaw(ctx, "o", "r", "s", RawOptions{Type: Diff})
191 if got != "" {
192 t.Errorf("testNewRequestAndDoFailure %v = %#v, want ''", methodName, got)
193 }
194 return resp, err
195 })
196}
197
198func TestRepositoriesService_GetCommitRaw_patch(t *testing.T) {
199 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testHeaderFunction · 0.85
testBadOptionsFunction · 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…