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

Function TestRepositoriesService_CreateStatus

github/repos_statuses_test.go:62–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestRepositoriesService_CreateStatus(t *testing.T) {
63 t.Parallel()
64 client, mux, _ := setup(t)
65
66 input := RepoStatus{State: Ptr("s"), TargetURL: Ptr("t"), Description: Ptr("d")}
67
68 mux.HandleFunc("/repos/o/r/statuses/r", func(w http.ResponseWriter, r *http.Request) {
69 testMethod(t, r, "POST")
70 testJSONBody(t, r, input)
71 fmt.Fprint(w, `{"id":1}`)
72 })
73
74 ctx := t.Context()
75 status, _, err := client.Repositories.CreateStatus(ctx, "o", "r", "r", input)
76 if err != nil {
77 t.Errorf("Repositories.CreateStatus returned error: %v", err)
78 }
79
80 want := &RepoStatus{ID: Ptr(int64(1))}
81 if !cmp.Equal(status, want) {
82 t.Errorf("Repositories.CreateStatus returned %+v, want %+v", status, want)
83 }
84
85 const methodName = "CreateStatus"
86 testBadOptions(t, methodName, func() (err error) {
87 _, _, err = client.Repositories.CreateStatus(ctx, "\n", "\n", "\n", input)
88 return err
89 })
90
91 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
92 got, resp, err := client.Repositories.CreateStatus(ctx, "o", "r", "r", input)
93 if got != nil {
94 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
95 }
96 return resp, err
97 })
98}
99
100func TestRepositoriesService_CreateStatus_invalidOwner(t *testing.T) {
101 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
testBadOptionsFunction · 0.85
CreateStatusMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…