(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func Test_deleteRun(t *testing.T) { |
| 14 | ios, _, stdout, stderr := iostreams.Test() |
| 15 | ios.SetStdinTTY(false) |
| 16 | ios.SetStdoutTTY(true) |
| 17 | ios.SetStderrTTY(true) |
| 18 | |
| 19 | tr := httpmock.Registry{} |
| 20 | defer tr.Verify(t) |
| 21 | |
| 22 | tr.Register( |
| 23 | httpmock.REST("DELETE", "repos/OWNER/REPO/keys/1234"), |
| 24 | httpmock.StringResponse(`{}`)) |
| 25 | |
| 26 | err := deleteRun(&DeleteOptions{ |
| 27 | IO: ios, |
| 28 | HTTPClient: func() (*http.Client, error) { |
| 29 | return &http.Client{Transport: &tr}, nil |
| 30 | }, |
| 31 | BaseRepo: func() (ghrepo.Interface, error) { |
| 32 | return ghrepo.New("OWNER", "REPO"), nil |
| 33 | }, |
| 34 | KeyID: "1234", |
| 35 | }) |
| 36 | assert.NoError(t, err) |
| 37 | |
| 38 | assert.Equal(t, "", stderr.String()) |
| 39 | assert.Equal(t, "✓ Deploy key deleted from OWNER/REPO\n", stdout.String()) |
| 40 | } |
nothing calls this directly
no test coverage detected