(t *testing.T)
| 242 | } |
| 243 | |
| 244 | func TestIssuesService_Get(t *testing.T) { |
| 245 | t.Parallel() |
| 246 | client, mux, _ := setup(t) |
| 247 | |
| 248 | mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { |
| 249 | testMethod(t, r, "GET") |
| 250 | testHeader(t, r, "Accept", mediaTypeReactionsPreview) |
| 251 | fmt.Fprint(w, `{"number":1, "author_association": "MEMBER","labels": [{"url": "u", "name": "n", "color": "c"}]}`) |
| 252 | }) |
| 253 | |
| 254 | ctx := t.Context() |
| 255 | issue, _, err := client.Issues.Get(ctx, "o", "r", 1) |
| 256 | if err != nil { |
| 257 | t.Errorf("Issues.Get returned error: %v", err) |
| 258 | } |
| 259 | |
| 260 | want := &Issue{ |
| 261 | Number: Ptr(1), |
| 262 | AuthorAssociation: Ptr("MEMBER"), |
| 263 | Labels: []*Label{{ |
| 264 | URL: Ptr("u"), |
| 265 | Name: Ptr("n"), |
| 266 | Color: Ptr("c"), |
| 267 | }}, |
| 268 | } |
| 269 | if !cmp.Equal(issue, want) { |
| 270 | t.Errorf("Issues.Get returned %+v, want %+v", issue, want) |
| 271 | } |
| 272 | |
| 273 | const methodName = "Get" |
| 274 | testBadOptions(t, methodName, func() (err error) { |
| 275 | _, _, err = client.Issues.Get(ctx, "\n", "\n", 1) |
| 276 | return err |
| 277 | }) |
| 278 | |
| 279 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 280 | got, resp, err := client.Issues.Get(ctx, "o", "r", 1) |
| 281 | if got != nil { |
| 282 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 283 | } |
| 284 | return resp, err |
| 285 | }) |
| 286 | } |
| 287 | |
| 288 | func TestIssuesService_Get_invalidOwner(t *testing.T) { |
| 289 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…