Skip to content

Commit 828694c

Browse files
committed
API tests
1 parent 9f66e1a commit 828694c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

coderd/notifications_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,27 @@ import (
1313
func TestUpdateNotificationsSettings(t *testing.T) {
1414
t.Parallel()
1515

16+
t.Run("Permissions denied", func(t *testing.T) {
17+
t.Parallel()
18+
19+
api := coderdtest.New(t, nil)
20+
firstUser := coderdtest.CreateFirstUser(t, api)
21+
anotherClient, _ := coderdtest.CreateAnotherUser(t, api, firstUser.OrganizationID)
22+
23+
// given
24+
expected := codersdk.NotificationsSettings{
25+
NotifierPaused: true,
26+
}
27+
28+
ctx := testutil.Context(t, testutil.WaitShort)
29+
30+
// when
31+
err := anotherClient.PutNotificationsSettings(ctx, expected)
32+
33+
// then
34+
require.Error(t, err) // Insufficient permissions to update notifications settings.
35+
})
36+
1637
t.Run("Settings modified", func(t *testing.T) {
1738
t.Parallel()
1839

0 commit comments

Comments
 (0)