@@ -115,7 +115,7 @@ func TestOAuthClientsCreate(t *testing.T) {
115
115
assert .Equal (t , 1 , len (oc .OAuthTokens ))
116
116
assert .Equal (t , ServiceProviderGithub , oc .ServiceProvider )
117
117
118
- t .Run ("the organization relationship is decoded correcly " , func (t * testing.T ) {
118
+ t .Run ("the organization relationship is decoded correctly " , func (t * testing.T ) {
119
119
assert .NotEmpty (t , oc .Organization )
120
120
})
121
121
})
@@ -224,6 +224,7 @@ func TestOAuthClientsRead(t *testing.T) {
224
224
assert .Equal (t , ocTest .ServiceProvider , oc .ServiceProvider )
225
225
assert .Equal (t , ocTest .ServiceProviderName , oc .ServiceProviderName )
226
226
assert .Equal (t , ocTest .OAuthTokens , oc .OAuthTokens )
227
+ assert .Equal (t , ocTest .OrganizationScoped , oc .OrganizationScoped )
227
228
})
228
229
229
230
t .Run ("when the OAuth client does not exist" , func (t * testing.T ) {
@@ -383,6 +384,38 @@ func TestOAuthClientsCreateOptionsValid(t *testing.T) {
383
384
})
384
385
}
385
386
387
+ func TestOAuthClientsUpdate (t * testing.T ) {
388
+ skipUnlessBeta (t )
389
+ client := testClient (t )
390
+ ctx := context .Background ()
391
+
392
+ orgTest , orgTestCleanup := createOrganization (t , client )
393
+ defer orgTestCleanup ()
394
+
395
+ t .Run ("updates organization scoped" , func (t * testing.T ) {
396
+ organizationScoped := false
397
+ organizationScopedTrue := true
398
+ options := OAuthClientCreateOptions {
399
+ APIURL : String ("https://bbs.com" ),
400
+ HTTPURL : String ("https://bbs.com" ),
401
+ ServiceProvider : ServiceProvider (ServiceProviderBitbucketServer ),
402
+ OrganizationScoped : & organizationScopedTrue ,
403
+ }
404
+
405
+ origOC , err := client .OAuthClients .Create (ctx , orgTest .Name , options )
406
+ require .NoError (t , err )
407
+ assert .NotEmpty (t , origOC .ID )
408
+
409
+ updateOpts := OAuthClientUpdateOptions {
410
+ OrganizationScoped : & organizationScoped ,
411
+ }
412
+ oc , err := client .OAuthClients .Update (ctx , origOC .ID , updateOpts )
413
+ require .NoError (t , err )
414
+ assert .NotEmpty (t , oc .ID )
415
+ assert .NotEqual (t , origOC .OrganizationScoped , oc .OrganizationScoped )
416
+ })
417
+ }
418
+
386
419
const publicKey = `
387
420
-----BEGIN PUBLIC KEY-----
388
421
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoKizy4xbN6qZFAwIJV24
0 commit comments