@@ -113,10 +113,15 @@ func TestScim(t *testing.T) {
113
113
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
114
114
defer cancel ()
115
115
116
+ // given
116
117
scimAPIKey := []byte ("hi" )
117
118
mockAudit := audit .NewMock ()
119
+ notifyEnq := & testutil.FakeNotificationsEnqueuer {}
118
120
client , _ := coderdenttest .New (t , & coderdenttest.Options {
119
- Options : & coderdtest.Options {Auditor : mockAudit },
121
+ Options : & coderdtest.Options {
122
+ Auditor : mockAudit ,
123
+ NotificationsEnqueuer : notifyEnq ,
124
+ },
120
125
SCIMAPIKey : scimAPIKey ,
121
126
AuditLogging : true ,
122
127
LicenseOptions : & coderdenttest.LicenseOptions {
@@ -129,12 +134,15 @@ func TestScim(t *testing.T) {
129
134
})
130
135
mockAudit .ResetLogs ()
131
136
137
+ // when
132
138
sUser := makeScimUser (t )
133
139
res , err := client .Request (ctx , "POST" , "/scim/v2/Users" , sUser , setScimAuth (scimAPIKey ))
134
140
require .NoError (t , err )
135
141
defer res .Body .Close ()
136
142
require .Equal (t , http .StatusOK , res .StatusCode )
137
143
144
+ // then
145
+ // Expect audit logs
138
146
aLogs := mockAudit .AuditLogs ()
139
147
require .Len (t , aLogs , 1 )
140
148
af := map [string ]string {}
@@ -143,12 +151,15 @@ func TestScim(t *testing.T) {
143
151
assert .Equal (t , coderd .SCIMAuditAdditionalFields , af )
144
152
assert .Equal (t , database .AuditActionCreate , aLogs [0 ].Action )
145
153
154
+ // Expect users exposed over API
146
155
userRes , err := client .Users (ctx , codersdk.UsersRequest {Search : sUser .Emails [0 ].Value })
147
156
require .NoError (t , err )
148
157
require .Len (t , userRes .Users , 1 )
149
-
150
158
assert .Equal (t , sUser .Emails [0 ].Value , userRes .Users [0 ].Email )
151
159
assert .Equal (t , sUser .UserName , userRes .Users [0 ].Username )
160
+
161
+ // Expect zero notifications (SkipNotifications = true)
162
+ require .Empty (t , notifyEnq .Sent )
152
163
})
153
164
154
165
t .Run ("Duplicate" , func (t * testing.T ) {
0 commit comments