Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8a6e289

Browse files
committed
Fix tests
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent061b2bf commit8a6e289

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

‎cli/notifications_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ import (
1616
"github.com/coder/coder/v2/testutil"
1717
)
1818

19+
funccreateOpts(t*testing.T)*coderdtest.Options {
20+
t.Helper()
21+
22+
dt:=coderdtest.DeploymentValues(t)
23+
dt.Experiments= []string{string(codersdk.ExperimentNotifications)}
24+
return&coderdtest.Options{
25+
DeploymentValues:dt,
26+
}
27+
}
28+
1929
funcTestNotifications(t*testing.T) {
2030
t.Parallel()
2131

@@ -42,7 +52,7 @@ func TestNotifications(t *testing.T) {
4252
t.Parallel()
4353

4454
// given
45-
ownerClient,db:=coderdtest.NewWithDatabase(t,nil)
55+
ownerClient,db:=coderdtest.NewWithDatabase(t,createOpts(t))
4656
_=coderdtest.CreateFirstUser(t,ownerClient)
4757

4858
// when
@@ -72,7 +82,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
7282
t.Parallel()
7383

7484
// given
75-
ownerClient,db:=coderdtest.NewWithDatabase(t,nil)
85+
ownerClient,db:=coderdtest.NewWithDatabase(t,createOpts(t))
7686
owner:=coderdtest.CreateFirstUser(t,ownerClient)
7787
anotherClient,_:=coderdtest.CreateAnotherUser(t,ownerClient,owner.OrganizationID)
7888

@@ -87,7 +97,7 @@ func TestPauseNotifications_RegularUser(t *testing.T) {
8797
require.Error(t,err)
8898
require.ErrorAsf(t,err,&sdkError,"error should be of type *codersdk.Error")
8999
assert.Equal(t,http.StatusForbidden,sdkError.StatusCode())
90-
assert.Contains(t,sdkError.Message,"Insufficient permissions to update notifications settings.")
100+
assert.Contains(t,sdkError.Message,"Forbidden.")
91101

92102
// then
93103
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitShort)

‎coderd/notifications/notifications_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,9 @@ func TestCustomNotificationMethod(t *testing.T) {
799799
require.NoError(t,err)
800800
require.EventuallyWithT(t,func(ct*assert.CollectT) {
801801
msgs:=mockSMTPSrv.MessagesAndPurge()
802-
assert.Len(ct,msgs,1)
803-
assert.Contains(ct,msgs[0].MsgRequest(),fmt.Sprintf("Message-Id: %s",msgID))
802+
ifassert.Len(ct,msgs,1) {
803+
assert.Contains(ct,msgs[0].MsgRequest(),fmt.Sprintf("Message-Id: %s",msgID))
804+
}
804805
},testutil.WaitLong,testutil.IntervalFast)
805806
}
806807

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp