MCPcopy
hub / github.com/hasura/graphql-engine / TestServerConfig_GetAdminSecret

Function TestServerConfig_GetAdminSecret

cli/cli_test.go:115–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func TestServerConfig_GetAdminSecret(t *testing.T) {
116 type fields struct {
117 adminSecret string
118 adminSecrets []string
119 }
120 tests := []struct {
121 name string
122 fields fields
123 want string
124 }{
125 {
126 "admin secrets takes precedence when adminSecret & adminSecrets are set",
127 fields{"test", []string{"foo", "bar"}},
128 "foo",
129 },
130 {
131 "admin secret is returned when set",
132 fields{"test", []string{}},
133 "test",
134 },
135 {
136 "empty string is returned when none is set",
137 fields{"", []string{}},
138 "",
139 },
140 }
141 for _, tt := range tests {
142 t.Run(tt.name, func(t *testing.T) {
143 c := &ServerConfig{
144 AdminSecret: tt.fields.adminSecret,
145 AdminSecrets: tt.fields.adminSecrets,
146 }
147 got := c.GetAdminSecret()
148 assert.Equal(t, tt.want, got)
149 })
150 }
151}

Callers

nothing calls this directly

Calls 2

GetAdminSecretMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected