MCPcopy Create free account
hub / github.com/cli/cli / TestGet

Function TestGet

pkg/cmd/issue/artifact/client/client_test.go:381–523  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

379}
380
381func TestGet(t *testing.T) {
382 createdAt := time.Date(2026, 9, 21, 23, 0, 0, 0, time.UTC)
383 updatedAt := time.Date(2026, 9, 24, 21, 0, 0, 0, time.UTC)
384 version5At := time.Date(2026, 9, 22, 20, 0, 0, 0, time.UTC)
385
386 tests := []struct {
387 name string
388 repo ghrepo.Interface
389 number int
390 response httpmock.Responder
391 want *ArtifactWithVersions
392 wantURL string
393 wantErr string
394 }{
395 {
396 name: "decodes the artifact and its versions, in the API's order",
397 repo: ghrepo.New("monalisa", "monas-cafe"),
398 number: 2,
399 response: httpmock.StringResponse(`{
400 "artifact": {
401 "id": 6626,
402 "number": 2,
403 "type": "generic",
404 "name": "OAuth callback plan",
405 "body": "# OAuth callback plan",
406 "body_html": "<h1>OAuth callback plan</h1>",
407 "description": "Register the callback URL.",
408 "creator": {"login": "hubot", "id": 2},
409 "updated_by_actor": {"login": "monalisa", "id": 1},
410 "created_at": "2026-09-21T23:00:00Z",
411 "updated_at": "2026-09-24T21:00:00Z",
412 "html_url": "https://github.com/monalisa/monas-cafe/issues/142/artifacts/2"
413 },
414 "versions": [
415 {
416 "version": 12,
417 "name": "OAuth callback plan",
418 "body": "# OAuth callback plan",
419 "body_html": "<h1>OAuth callback plan</h1>",
420 "created_at": "2026-09-24T21:00:00Z",
421 "actor": {"login": "monalisa", "id": 1}
422 },
423 {
424 "version": 5,
425 "name": "OAuth plan",
426 "body": "# OAuth plan\n\n1. Register the callback URL.",
427 "body_html": "",
428 "created_at": "2026-09-22T20:00:00Z",
429 "actor": {"login": "monalisa", "id": 1}
430 },
431 {
432 "version": 1,
433 "name": "OAuth plan",
434 "body": "# OAuth plan",
435 "body_html": "",
436 "created_at": null,
437 "actor": null
438 }

Callers

nothing calls this directly

Calls 14

VerifyMethod · 0.95
RegisterMethod · 0.95
GetMethod · 0.95
NewFunction · 0.92
StringResponseFunction · 0.92
NewWithHostFunction · 0.92
JSONResponseFunction · 0.92
StatusJSONResponseFunction · 0.92
RESTFunction · 0.92
NewArtifactClientFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected