MCPcopy
hub / github.com/cli/cli / TestRemoveRun

Function TestRemoveRun

pkg/cmd/variable/delete/delete_test.go:89–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestRemoveRun(t *testing.T) {
90 tests := []struct {
91 name string
92 opts *DeleteOptions
93 host string
94 httpStubs func(*httpmock.Registry)
95 }{
96 {
97 name: "repo",
98 opts: &DeleteOptions{
99 VariableName: "cool_variable",
100 },
101 host: "github.com",
102 httpStubs: func(reg *httpmock.Registry) {
103 reg.Register(httpmock.WithHost(httpmock.REST("DELETE", "repos/owner/repo/actions/variables/cool_variable"), "api.github.com"),
104 httpmock.StatusStringResponse(204, "No Content"))
105 },
106 },
107 {
108 name: "repo GHES",
109 opts: &DeleteOptions{
110 VariableName: "cool_variable",
111 },
112 host: "example.com",
113 httpStubs: func(reg *httpmock.Registry) {
114 reg.Register(httpmock.WithHost(httpmock.REST("DELETE", "api/v3/repos/owner/repo/actions/variables/cool_variable"), "example.com"),
115 httpmock.StatusStringResponse(204, "No Content"))
116 },
117 },
118 {
119 name: "env",
120 opts: &DeleteOptions{
121 VariableName: "cool_variable",
122 EnvName: "development",
123 },
124 host: "github.com",
125 httpStubs: func(reg *httpmock.Registry) {
126 reg.Register(httpmock.WithHost(httpmock.REST("DELETE", "repos/owner/repo/environments/development/variables/cool_variable"), "api.github.com"),
127 httpmock.StatusStringResponse(204, "No Content"))
128 },
129 },
130 {
131 name: "env GHES",
132 opts: &DeleteOptions{
133 VariableName: "cool_variable",
134 EnvName: "development",
135 },
136 host: "example.com",
137 httpStubs: func(reg *httpmock.Registry) {
138 reg.Register(httpmock.WithHost(httpmock.REST("DELETE", "api/v3/repos/owner/repo/environments/development/variables/cool_variable"), "example.com"),
139 httpmock.StatusStringResponse(204, "No Content"))
140 },
141 },
142 {
143 name: "org",
144 opts: &DeleteOptions{
145 VariableName: "cool_variable",
146 OrgName: "UmbrellaCorporation",

Callers

nothing calls this directly

Calls 10

RegisterMethod · 0.95
VerifyMethod · 0.95
WithHostFunction · 0.92
RESTFunction · 0.92
StatusStringResponseFunction · 0.92
TestFunction · 0.92
NewBlankConfigFunction · 0.92
FromFullNameWithHostFunction · 0.92
removeRunFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected