(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func 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", |
nothing calls this directly
no test coverage detected