Commit 095f9c67 authored by Xavier Guimard's avatar Xavier Guimard

Fix LDAP policy test (Closes: #1639)

parent 0686a084
Pipeline #4354 passed with stages
in 10 minutes and 36 seconds
...@@ -16,17 +16,17 @@ SKIP: { ...@@ -16,17 +16,17 @@ SKIP: {
my $client = LLNG::Manager::Test->new( my $client = LLNG::Manager::Test->new(
{ {
ini => { ini => {
logLevel => 'error', logLevel => 'error',
useSafeJail => 1, useSafeJail => 1,
authentication => 'LDAP', authentication => 'LDAP',
portal => 'http://auth.example.com/', portal => 'http://auth.example.com/',
userDB => 'Same', userDB => 'Same',
passwordDB => 'LDAP', passwordDB => 'LDAP',
portalRequireOldPassword => 1, portalRequireOldPassword => 1,
ldapServer => 'ldap://127.0.0.1:19389/', ldapServer => 'ldap://127.0.0.1:19389/',
ldapBase => 'ou=users,dc=example,dc=com', ldapBase => 'ou=users,dc=example,dc=com',
managerDn => 'cn=lemonldapng,ou=dsa,dc=example,dc=com', managerDn => 'cn=lemonldapng,ou=dsa,dc=example,dc=com',
managerPassword => 'lemonldapng', managerPassword => 'lemonldapng',
ldapAllowResetExpiredPassword => 1, ldapAllowResetExpiredPassword => 1,
ldapPpolicyControl => 1, ldapPpolicyControl => 1,
} }
...@@ -127,8 +127,8 @@ SKIP: { ...@@ -127,8 +127,8 @@ SKIP: {
# 3 - TEST PE_PP_PASSWORD_TOO_SHORT # 3 - TEST PE_PP_PASSWORD_TOO_SHORT
# --------------------------------- # ---------------------------------
$user = 'short'; $user = 'short';
$code = PE_PP_PASSWORD_TOO_SHORT; $code = PE_PP_PASSWORD_TOO_SHORT;
$postString = "user=$user&password=passwordnottooshort"; $postString = "user=$user&password=passwordnottooshort";
# Try yo authenticate # Try yo authenticate
...@@ -142,19 +142,21 @@ SKIP: { ...@@ -142,19 +142,21 @@ SKIP: {
'Auth query' 'Auth query'
); );
my $id = expectCookie($res); my $id = expectCookie($res);
$query =
'oldpassword=passwordnottooshort&newpassword=test&confirmpassword=test';
ok( ok(
$res = $client->_post( $res = $client->_post(
'/', '/',
IO::String->new( IO::String->new($query),
'oldpassword=passwordnottooshort&newpassword=test&confirmpassword=test'),
cookie => "lemonldap=$id", cookie => "lemonldap=$id",
accept => 'text/html', accept => 'text/html',
length => 69 length => length($query),
), ),
'Change password' 'Change password'
); );
$match = 'trmsg="' . PE_PP_PASSWORD_TOO_SHORT . '"'; $match = 'trmsg="' . PE_PP_PASSWORD_TOO_SHORT . '"';
ok( $res->[2]->[0] =~ /$match/s, 'Password is not changed' ); ok( $res->[2]->[0] =~ /$match/s, 'Password is not changed' );
# Verify that password isn't changed # Verify that password isn't changed
$client->logout($id); $client->logout($id);
ok( ok(
...@@ -165,20 +167,21 @@ SKIP: { ...@@ -165,20 +167,21 @@ SKIP: {
), ),
'Auth query' 'Auth query'
); );
my $id = expectCookie($res); $id = expectCookie($res);
$query =
'oldpassword=passwordnottooshort&newpassword=testmore&confirmpassword=testmore';
ok( ok(
$res = $client->_post( $res = $client->_post(
'/', '/',
IO::String->new( IO::String->new($query),
'oldpassword=passwordnottooshort&newpassword=testmore&confirmpassword=testmore'),
cookie => "lemonldap=$id", cookie => "lemonldap=$id",
accept => 'text/html', accept => 'text/html',
length => 54 length => length($query),
), ),
'Change password' 'Change password'
); );
$match = 'trmsg="' . PE_PASSWORD_OK . '"'; $match = 'trmsg="' . PE_PASSWORD_OK . '"';
ok( $res->[2]->[0] !~ /$match/s, 'Password is not changed' ); ok( $res->[2]->[0] =~ /$match/s, 'Password is changed' );
} }
count($maintests); count($maintests);
clean_sessions(); clean_sessions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment