MCPcopy Index your code
hub / github.com/coder/coder / requireSecretValidation

Function requireSecretValidation

coderd/usersecrets_test.go:451–465  ·  view source on GitHub ↗
(t *testing.T, err error, status int, field string)

Source from the content-addressed store, hash-verified

449}
450
451func requireSecretValidation(t *testing.T, err error, status int, field string) codersdk.ValidationError {
452 t.Helper()
453
454 require.Error(t, err)
455 var sdkErr *codersdk.Error
456 require.ErrorAs(t, err, &sdkErr)
457 assert.Equal(t, status, sdkErr.StatusCode())
458 for _, validation := range sdkErr.Validations {
459 if validation.Field == field {
460 return validation
461 }
462 }
463 require.Failf(t, "missing validation", "field %q not found in %#v", field, sdkErr.Validations)
464 return codersdk.ValidationError{}
465}
466
467// TestUserSecretLimits exercises the per-user count and byte caps
468// enforced by enforce_user_secrets_per_user_limits across both POST

Calls 4

StatusCodeMethod · 0.95
HelperMethod · 0.65
ErrorMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected