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