Skip to content

Commit

Permalink
test(ldap/roles): minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
kirangodishala committed Jul 29, 2024
1 parent 6834e33 commit 269ed62
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,8 @@ class LdapUserRolesProviderTest extends Specification {
'uid=dn2,ou=users,dc=springframework,dc=org' : 'user1']
}
provider.ldapTemplate = Mock(SpringSecurityLdapTemplate) {
_ * searchForSingleEntry(*_) >> { throw new IncorrectResultSizeDataAccessException(1) }
_ * searchForSingleAttributeValues(_, _, ['uid=dn1,ou=users,dc=springframework,dc=org','user1'], _) >> ['group1']
_ * searchForSingleAttributeValues(_, _, ['uid=dn2,ou=users,dc=springframework,dc=org','user1'], _) >> ['group2']
1 * searchForSingleAttributeValues(_, _, ['uid=dn1,ou=users,dc=springframework,dc=org','user1'], _) >> ['group1']
1 * searchForSingleAttributeValues(_, _, ['uid=dn2,ou=users,dc=springframework,dc=org','user1'], _) >> ['group2']
}
provider.setConfigProps(configProps)

Expand All @@ -311,6 +310,7 @@ class LdapUserRolesProviderTest extends Specification {
def roles = provider.loadRolesForUser(user)

then:
0 * provider.getUserFullDn(_ as String)
roles.sort() == [role1, role2].sort()
}

Expand Down

0 comments on commit 269ed62

Please sign in to comment.