MCPcopy Create free account
hub / github.com/anchordotdev/cli / TestConfigEncodeTOML

Function TestConfigEncodeTOML

config_test.go:183–254  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

181}
182
183func TestConfigEncodeTOML(t *testing.T) {
184 tests := []struct {
185 name string
186
187 cfgFn func(*Config)
188
189 toml string
190 }{
191 {
192 name: "empty-when-only-readonlys-set",
193
194 cfgFn: func(cfg *Config) {
195 cfg.NonInteractive = true
196 cfg.API.Token = "f00f"
197 cfg.Lcl.LclHostURL = "https://lcl-host.example.com"
198 cfg.Lcl.Diagnostic.Addr = ":4567"
199 cfg.Lcl.Diagnostic.Subdomain = "not-anky"
200 cfg.Lcl.MkCert.Domains = []string{"example.com"}
201 cfg.Lcl.MkCert.SubCa = "f00f:f00f:f00f"
202 cfg.Realm.APID = "not-localhost"
203 cfg.Service.EnvOutput = "clipboard"
204 cfg.Trust.NoSudo = true
205 cfg.Trust.MockMode = true
206 cfg.Trust.Stores = []string{"mock"}
207 cfg.Trust.Clean.States = []string{"valid"}
208 cfg.Keyring.MockMode = true
209 },
210
211 toml: "",
212 },
213 {
214 name: "service-acme-example",
215
216 cfgFn: func(cfg *Config) {
217 cfg.Lcl.RealmAPID = "localhost"
218 cfg.Org.APID = "test-org"
219 cfg.Service.APID = "test-service"
220 cfg.Service.Category = "ruby"
221 cfg.Service.CertStyle = "acme"
222 },
223
224 toml: heredoc.Doc(`
225 [lcl-host]
226 realm-apid = 'localhost'
227
228 [org]
229 apid = 'test-org'
230
231 [service]
232 apid = 'test-service'
233 category = 'ruby'
234 cert-style = 'acme'
235 `),
236 },
237 }
238
239 for _, test := range tests {
240 t.Run(test.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

encodeTOMLMethod · 0.95
RunMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected