@@ -490,7 +490,6 @@ func TestOAuthIntrospection(t *testing.T) {
490490func  TestOAuth_GrantScopesReadUserFailRepos (t  * testing.T ) {
491491	defer  tests .PrepareTestEnv (t )()
492492
493- 	setting .OAuth2 .EnableAdditionalGrantScopes  =  true 
494493	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 })
495494	appBody  :=  api.CreateOAuth2ApplicationOptions {
496495		Name : "oauth-provider-scopes-test" ,
@@ -516,7 +515,7 @@ func TestOAuth_GrantScopesReadUserFailRepos(t *testing.T) {
516515	err  :=  db .Insert (db .DefaultContext , grant )
517516	require .NoError (t , err )
518517
519- 	assert .Contains (t , grant . Scope ,  "openid  profile  email  read:user" )
518+ 	assert .ElementsMatch (t , [] string { "openid"  ,  " profile" ,  " email" ,  " read:user"},  strings . Split ( grant . Scope ,  " " ) )
520519
521520	ctx  :=  loginUserWithPasswordRemember (t , user .Name , "password" , true )
522521
@@ -572,7 +571,6 @@ func TestOAuth_GrantScopesReadUserFailRepos(t *testing.T) {
572571func  TestOAuth_GrantScopesReadRepositoryFailOrganization (t  * testing.T ) {
573572	defer  tests .PrepareTestEnv (t )()
574573
575- 	setting .OAuth2 .EnableAdditionalGrantScopes  =  true 
576574	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {ID : 2 })
577575	appBody  :=  api.CreateOAuth2ApplicationOptions {
578576		Name : "oauth-provider-scopes-test" ,
@@ -598,7 +596,7 @@ func TestOAuth_GrantScopesReadRepositoryFailOrganization(t *testing.T) {
598596	err  :=  db .Insert (db .DefaultContext , grant )
599597	require .NoError (t , err )
600598
601- 	assert .Contains (t , grant . Scope ,  "openid  profile  email  read:user  read:repository" )
599+ 	assert .ElementsMatch (t , [] string { "openid"  ,  " profile" ,  " email" ,  " read:user" ,  " read:repository"},  strings . Split ( grant . Scope ,  " " ) )
602600
603601	ctx  :=  loginUserWithPasswordRemember (t , user .Name , "password" , true )
604602
@@ -814,10 +812,9 @@ func TestOAuth_GrantScopesReadRepositoriesPublicOnly(t *testing.T) {
814812	assert .Equal (t , reposExpected , reposCaptured )
815813}
816814
817- func  TestOAuth_GrantScopesNotEnabledClaimGroups (t  * testing.T ) {
815+ func  TestOAuth_GrantScopesClaimGroupsAll (t  * testing.T ) {
818816	defer  tests .PrepareTestEnv (t )()
819817
820- 	setting .OAuth2 .EnableAdditionalGrantScopes  =  false 
821818	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {Name : "user2" })
822819
823820	appBody  :=  api.CreateOAuth2ApplicationOptions {
@@ -894,10 +891,9 @@ func TestOAuth_GrantScopesNotEnabledClaimGroups(t *testing.T) {
894891	}
895892}
896893
897- func  TestOAuth_GrantScopesEnabledClaimGroups (t  * testing.T ) {
894+ func  TestOAuth_GrantScopesClaimGroupsPublicOnly (t  * testing.T ) {
898895	defer  tests .PrepareTestEnv (t )()
899896
900- 	setting .OAuth2 .EnableAdditionalGrantScopes  =  true 
901897	user  :=  unittest .AssertExistsAndLoadBean (t , & user_model.User {Name : "user2" })
902898
903899	appBody  :=  api.CreateOAuth2ApplicationOptions {
@@ -924,7 +920,7 @@ func TestOAuth_GrantScopesEnabledClaimGroups(t *testing.T) {
924920	err  :=  db .Insert (db .DefaultContext , grant )
925921	require .NoError (t , err )
926922
927- 	assert .Contains (t , grant . Scope ,  "openid  profile  email  groups" )
923+ 	assert .ElementsMatch (t , [] string { "openid"  ,  " profile" ,  " email" ,  " groups"},  strings . Split ( grant . Scope ,  " " ) )
928924
929925	ctx  :=  loginUserWithPasswordRemember (t , user .Name , "password" , true )
930926
0 commit comments