@@ -188,7 +188,7 @@ func TestOAuth2ProviderApps(t *testing.T) {
188
188
ctx := testutil .Context (t , testutil .WaitLong )
189
189
190
190
// No apps yet.
191
- apps , err := another .OAuth2ProviderApps (ctx )
191
+ apps , err := another .OAuth2ProviderApps (ctx , codersdk. OAuth2ProviderAppFilter {} )
192
192
require .NoError (t , err )
193
193
require .Len (t , apps , 0 )
194
194
@@ -200,7 +200,7 @@ func TestOAuth2ProviderApps(t *testing.T) {
200
200
}
201
201
202
202
// Should get all the apps now.
203
- apps , err = another .OAuth2ProviderApps (ctx )
203
+ apps , err = another .OAuth2ProviderApps (ctx , codersdk. OAuth2ProviderAppFilter {} )
204
204
require .NoError (t , err )
205
205
require .Len (t , apps , 5 )
206
206
require .Equal (t , expectedOrder , apps )
@@ -244,12 +244,29 @@ func TestOAuth2ProviderApps(t *testing.T) {
244
244
require .NoError (t , err )
245
245
246
246
// Should show the new count.
247
- newApps , err := another .OAuth2ProviderApps (ctx )
247
+ newApps , err := another .OAuth2ProviderApps (ctx , codersdk. OAuth2ProviderAppFilter {} )
248
248
require .NoError (t , err )
249
249
require .Len (t , newApps , 4 )
250
250
251
251
require .Equal (t , expectedOrder [1 :], newApps )
252
252
})
253
+
254
+ t .Run ("ByUser" , func (t * testing.T ) {
255
+ t .Parallel ()
256
+ client , owner := coderdenttest .New (t , & coderdenttest.Options {LicenseOptions : & coderdenttest.LicenseOptions {
257
+ Features : license.Features {
258
+ codersdk .FeatureOAuth2Provider : 1 ,
259
+ },
260
+ }})
261
+ another , user := coderdtest .CreateAnotherUser (t , client , owner .OrganizationID )
262
+ ctx := testutil .Context (t , testutil .WaitLong )
263
+ _ = generateApps (ctx , t , client )
264
+ apps , err := another .OAuth2ProviderApps (ctx , codersdk.OAuth2ProviderAppFilter {
265
+ UserID : user .ID ,
266
+ })
267
+ require .NoError (t , err )
268
+ require .Len (t , apps , 0 )
269
+ })
253
270
}
254
271
255
272
func TestOAuth2ProviderAppSecrets (t * testing.T ) {
0 commit comments