mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: return 404, not 400 if missing or authz deny (#22069)
This commit is contained in:
@@ -64,7 +64,7 @@ func TestRemoveOrganizationMembers(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
inv.Stdout = buf
|
||||
err := inv.WithContext(ctx).Run()
|
||||
require.ErrorContains(t, err, "must be an existing uuid or username")
|
||||
require.ErrorContains(t, err, "Resource not found or you do not have access to this resource")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -356,7 +356,7 @@ func TestGrantSiteRoles(t *testing.T) {
|
||||
AssignToUser: uuid.NewString(),
|
||||
Roles: []string{codersdk.RoleOwner},
|
||||
Error: true,
|
||||
StatusCode: http.StatusBadRequest,
|
||||
StatusCode: http.StatusNotFound,
|
||||
},
|
||||
{
|
||||
Name: "MemberCannotUpdateRoles",
|
||||
@@ -364,7 +364,7 @@ func TestGrantSiteRoles(t *testing.T) {
|
||||
AssignToUser: first.UserID.String(),
|
||||
Roles: []string{},
|
||||
Error: true,
|
||||
StatusCode: http.StatusBadRequest,
|
||||
StatusCode: http.StatusNotFound,
|
||||
},
|
||||
{
|
||||
// Cannot update your own roles
|
||||
|
||||
@@ -152,7 +152,7 @@ func TestEnterpriseMembers(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
var apiErr *codersdk.Error
|
||||
require.ErrorAs(t, err, &apiErr)
|
||||
require.Contains(t, apiErr.Message, "must be an existing")
|
||||
require.Contains(t, apiErr.Message, "Resource not found or you do not have access to this resource")
|
||||
})
|
||||
|
||||
// Calling it from a user without the org access.
|
||||
|
||||
Reference in New Issue
Block a user