TSK-1893: Convert LDAP AccessId Search inputs to lower case
Extended former testLdap_searchGroupByDn() method with upper case inputs and renamed according to the Testing Guidelines.
This commit is contained in:
parent
d03455c61f
commit
e69273bc5c
|
|
@ -232,7 +232,8 @@ public class LdapClient {
|
||||||
// given DN.
|
// given DN.
|
||||||
// https://stackoverflow.com/questions/55285743/spring-ldaptemplate-how-to-lookup-fully-qualified-dn-with-configured-base-dn
|
// https://stackoverflow.com/questions/55285743/spring-ldaptemplate-how-to-lookup-fully-qualified-dn-with-configured-base-dn
|
||||||
// Therefore we have to remove the base name from the dn before performing the lookup
|
// Therefore we have to remove the base name from the dn before performing the lookup
|
||||||
String nameWithoutBaseDn = getNameWithoutBaseDn(dn);
|
String nameWithoutBaseDn = getNameWithoutBaseDn(dn).toLowerCase();
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"Removed baseDN {} from given DN. New DN to be used: {}", getBaseDn(), nameWithoutBaseDn);
|
"Removed baseDN {} from given DN. New DN to be used: {}", getBaseDn(), nameWithoutBaseDn);
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ class LdapClientTest {
|
||||||
@Spy @InjectMocks LdapClient cut;
|
@Spy @InjectMocks LdapClient cut;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLdap_searchGroupByDn() {
|
void should_SearchGroupByDn_For_LdapCall() {
|
||||||
|
|
||||||
setUpEnvMock();
|
setUpEnvMock();
|
||||||
cut.init();
|
cut.init();
|
||||||
|
|
||||||
|
|
@ -58,6 +57,17 @@ class LdapClientTest {
|
||||||
.lookup(eq("cn=developersgroup,ou=groups"), any(), any(LdapClient.DnContextMapper.class));
|
.lookup(eq("cn=developersgroup,ou=groups"), any(), any(LdapClient.DnContextMapper.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void should_ConvertAccessIdToLowercase_When_SearchingGroupByDn() {
|
||||||
|
setUpEnvMock();
|
||||||
|
cut.init();
|
||||||
|
|
||||||
|
cut.searchAccessIdByDn("cn=Developersgroup,ou=groups,o=taskanatest");
|
||||||
|
|
||||||
|
verify(ldapTemplate)
|
||||||
|
.lookup(eq("cn=developersgroup,ou=groups"), any(), any(LdapClient.DnContextMapper.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLdap_searchUsersAndGroups() throws Exception {
|
void testLdap_searchUsersAndGroups() throws Exception {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue