MCPcopy Index your code
hub / github.com/google/go-github / TestRepositoriesService_Edit

Function TestRepositoriesService_Edit

github/repos_test.go:498–537  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

496}
497
498func TestRepositoriesService_Edit(t *testing.T) {
499 t.Parallel()
500 client, mux, _ := setup(t)
501
502 i := true
503 input := &Repository{HasIssues: &i}
504
505 wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview}
506 mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
507 testMethod(t, r, "PATCH")
508 testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
509 testJSONBody(t, r, input)
510 fmt.Fprint(w, `{"id":1}`)
511 })
512
513 ctx := t.Context()
514 got, _, err := client.Repositories.Edit(ctx, "o", "r", input)
515 if err != nil {
516 t.Errorf("Repositories.Edit returned error: %v", err)
517 }
518
519 want := &Repository{ID: Ptr(int64(1))}
520 if !cmp.Equal(got, want) {
521 t.Errorf("Repositories.Edit returned %+v, want %+v", got, want)
522 }
523
524 const methodName = "Edit"
525 testBadOptions(t, methodName, func() (err error) {
526 _, _, err = client.Repositories.Edit(ctx, "\n", "\n", input)
527 return err
528 })
529
530 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
531 got, resp, err := client.Repositories.Edit(ctx, "o", "r", input)
532 if got != nil {
533 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
534 }
535 return resp, err
536 })
537}
538
539func TestRepositoriesService_Delete(t *testing.T) {
540 t.Parallel()

Callers

nothing calls this directly

Calls 9

testMethodFunction · 0.85
testHeaderFunction · 0.85
testJSONBodyFunction · 0.85
testBadOptionsFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
EditMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…