(t *testing.T)
| 113 | } |
| 114 | |
| 115 | func 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 | } |
nothing calls this directly
no test coverage detected