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

Function TestRepositoriesService_GetCombinedStatus

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

Source from the content-addressed store, hash-verified

107}
108
109func TestRepositoriesService_GetCombinedStatus(t *testing.T) {
110 t.Parallel()
111 client, mux, _ := setup(t)
112
113 mux.HandleFunc("/repos/o/r/commits/r/status", func(w http.ResponseWriter, r *http.Request) {
114 testMethod(t, r, "GET")
115 testFormValues(t, r, values{"page": "2"})
116 fmt.Fprint(w, `{"state":"success", "statuses":[{"id":1}]}`)
117 })
118
119 opt := &ListOptions{Page: 2}
120 ctx := t.Context()
121 status, _, err := client.Repositories.GetCombinedStatus(ctx, "o", "r", "r", opt)
122 if err != nil {
123 t.Errorf("Repositories.GetCombinedStatus returned error: %v", err)
124 }
125
126 want := &CombinedStatus{State: Ptr("success"), Statuses: []*RepoStatus{{ID: Ptr(int64(1))}}}
127 if !cmp.Equal(status, want) {
128 t.Errorf("Repositories.GetCombinedStatus returned %+v, want %+v", status, want)
129 }
130
131 const methodName = "GetCombinedStatus"
132 testBadOptions(t, methodName, func() (err error) {
133 _, _, err = client.Repositories.GetCombinedStatus(ctx, "\n", "\n", "\n", opt)
134 return err
135 })
136
137 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
138 got, resp, err := client.Repositories.GetCombinedStatus(ctx, "o", "r", "r", opt)
139 if got != nil {
140 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
141 }
142 return resp, err
143 })
144}
145
146func TestRepoStatus_Marshal(t *testing.T) {
147 t.Parallel()

Callers

nothing calls this directly

Calls 8

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