MCPcopy Index your code
hub / github.com/cli/cli / Test_deleteRun

Function Test_deleteRun

pkg/cmd/repo/deploy-key/delete/delete_test.go:13–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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}

Callers

nothing calls this directly

Calls 12

VerifyMethod · 0.95
RegisterMethod · 0.95
TestFunction · 0.92
RESTFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
deleteRunFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected