(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func 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 | |
| 146 | func TestRepoStatus_Marshal(t *testing.T) { |
| 147 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…