MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestHasAllowMissingEnabled

Function TestHasAllowMissingEnabled

backend/api/v1/acl_test.go:185–246  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

183}
184
185func TestHasAllowMissingEnabled(t *testing.T) {
186 tests := []struct {
187 name string
188 request any
189 want bool
190 }{
191 {
192 name: "AllowMissing true",
193 request: &v1pb.UpdateRoleRequest{
194 AllowMissing: true,
195 },
196 want: true,
197 },
198 {
199 name: "AllowMissing false",
200 request: &v1pb.UpdateRoleRequest{
201 AllowMissing: false,
202 },
203 want: false,
204 },
205 {
206 name: "No AllowMissing field",
207 request: &v1pb.GetRoleRequest{
208 Name: "roles/test",
209 },
210 want: false,
211 },
212 {
213 name: "Nil request",
214 request: nil,
215 want: false,
216 },
217 {
218 name: "UpdateGroupRequest with AllowMissing true",
219 request: &v1pb.UpdateGroupRequest{
220 AllowMissing: true,
221 },
222 want: true,
223 },
224 {
225 name: "UpdateReviewConfigRequest with AllowMissing true",
226 request: &v1pb.UpdateReviewConfigRequest{
227 AllowMissing: true,
228 },
229 want: true,
230 },
231 {
232 name: "UpdateIdentityProviderRequest with AllowMissing false",
233 request: &v1pb.UpdateIdentityProviderRequest{
234 AllowMissing: false,
235 },
236 want: false,
237 },
238 }
239
240 for _, tt := range tests {
241 t.Run(tt.name, func(t *testing.T) {
242 got := hasAllowMissingEnabled(tt.request)

Callers

nothing calls this directly

Calls 3

hasAllowMissingEnabledFunction · 0.85
EqualMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected