Skip to content

Commit 6e88678

Browse files
committed
add invalid uuid test
1 parent 816f97c commit 6e88678

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

enterprise/coderd/roles_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,29 @@ func TestCustomOrganizationRole(t *testing.T) {
273273
_, err = owner.PatchOrganizationRole(ctx, first.OrganizationID, userRole)
274274
require.ErrorContains(t, err, "not allowed to assign user permissions")
275275
})
276+
277+
t.Run("InvalidUUID", func(t *testing.T) {
278+
t.Parallel()
279+
dv := coderdtest.DeploymentValues(t)
280+
dv.Experiments = []string{string(codersdk.ExperimentCustomRoles)}
281+
owner, first := coderdenttest.New(t, &coderdenttest.Options{
282+
Options: &coderdtest.Options{
283+
DeploymentValues: dv,
284+
},
285+
LicenseOptions: &coderdenttest.LicenseOptions{
286+
Features: license.Features{
287+
codersdk.FeatureCustomRoles: 1,
288+
},
289+
},
290+
})
291+
292+
ctx := testutil.Context(t, testutil.WaitMedium)
293+
294+
newRole := templateAdminCustom(first.OrganizationID)
295+
newRole.OrganizationID = "0000" // This is not a valid uuid
296+
297+
//nolint:gocritic // owner is required for this
298+
_, err := owner.PatchOrganizationRole(ctx, first.OrganizationID, newRole)
299+
require.ErrorContains(t, err, "Invalid request")
300+
})
276301
}

0 commit comments

Comments
 (0)