Commit 69a43172 authored by Christophe Maudoux's avatar Christophe Maudoux

Fix unit test (#1603)

parent 3496d898
...@@ -18,7 +18,7 @@ ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ), ...@@ -18,7 +18,7 @@ ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ),
"Request succeed" ); "Request succeed" );
ok( $res->[0] == 200, "Result code is 200" ); ok( $res->[0] == 200, "Result code is 200" );
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" ); ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
ok( $resBody->{result} == 0, "JSON response contains \"result:0\"" ) ok( $resBody->{result} == 1, "JSON response contains \"result:1\"" )
or print STDERR Dumper($res); or print STDERR Dumper($res);
ok( $res = &client->_get( '/confs/2/combModules', 'application/json' ), ok( $res = &client->_get( '/confs/2/combModules', 'application/json' ),
...@@ -37,4 +37,8 @@ count(9); ...@@ -37,4 +37,8 @@ count(9);
done_testing( count() ); done_testing( count() );
unlink 't/conf/lmConf-2.json'; unlink 't/conf/lmConf-2.json';
unlink 't/sessions/*';
`rm t/sessions/*`;
\ No newline at end of file
...@@ -25,4 +25,32 @@ sub count { ...@@ -25,4 +25,32 @@ sub count {
return $count; return $count;
} }
sub clean_sessions {
opendir D, 't/sessions' or die $!;
foreach ( grep { /^[^\.]/ } readdir(D) ) {
unlink "t/sessions/$_", "t/sessions/lock/Apache-Session-$_.lock";
}
foreach my $dir (qw(t/sessions/lock t/sessions/saml/lock t/sessions/saml)) {
if ( -d $dir ) {
opendir D, $dir or die $!;
foreach ( grep { /^[^\.]/ } readdir(D) ) {
unlink "$dir/$_";
}
}
}
my $cache = getCache();
$cache->clear;
}
sub getCache {
require Cache::FileCache;
return Cache::FileCache->new(
{
namespace => 'lemonldap-ng-session',
cache_root => 't/',
cache_depth => 0,
}
);
}
1; 1;
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