MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / TestAPIKeyPassedAsArg

Function TestAPIKeyPassedAsArg

internal/cli/setup_server_test.go:86–101  ·  view source on GitHub ↗

TestAPIKeyPassedAsArg makes sure that only an API key on the command line gives the warning.

(t *testing.T)

Source from the content-addressed store, hash-verified

84// TestAPIKeyPassedAsArg makes sure that only an API key on the command line
85// gives the warning.
86func TestAPIKeyPassedAsArg(t *testing.T) {
87 cases := []struct {
88 args []string
89 want bool
90 }{
91 {[]string{"--serve", "--api-key", "secret"}, true},
92 {[]string{"--serve", "--api-key=secret"}, true},
93 {[]string{"--serve"}, false},
94 {[]string{"--serve", "--address", "127.0.0.1:8080"}, false},
95 }
96 for _, c := range cases {
97 if got := apiKeyPassedAsArg(c.args); got != c.want {
98 t.Errorf("apiKeyPassedAsArg(%q) = %v, want %v", c.args, got, c.want)
99 }
100 }
101}

Callers

nothing calls this directly

Calls 1

apiKeyPassedAsArgFunction · 0.85

Tested by

no test coverage detected