Commit 09f1a45c authored by Yadd's avatar Yadd
Browse files

LEONLDAP::NG : Better tests for Lemonldap::NG::Common

parent ad0ed7f3
......@@ -14,10 +14,10 @@ META.yml Module meta-data (added by MakeMaker)
README
scripts/lmConfig_File2MySQL
storage.conf
t/01-Manager-Conf.t
t/02-Manager-Conf-File.t
t/03-Manager-Conf-DBI.t
t/04-Manager-Conf-SOAP.t
t/01-Common-Conf.t
t/02-Common-Conf-File.t
t/03-Common-Conf-DBI.t
t/04-Common-Conf-SOAP.t
t/10-Common.t
t/99-pod.t
tools/apache-session-mysql.sql
......
......@@ -15,8 +15,6 @@ our %_confFiles;
sub new {
my $class = shift;
my $args;
$args ||= {};
my $self = bless {}, $class;
if ( ref( $_[0] ) ) {
%$self = %{ $_[0] };
......@@ -25,7 +23,7 @@ sub new {
%$self = @_;
}
unless ( $self->{mdone} ) {
$self->_readConfFile( $self->{confFile} );
$self->_readConfFile( $self->{confFile} ) unless ( $self->{type} );
unless ( $self->{type} ) {
$msg .= "Error: configStorage: type is not defined\n";
return 0;
......
......@@ -5,7 +5,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 1;
use Test::More tests => 3;
BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
#########################
......@@ -13,3 +13,18 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
my $h;
ok(
(
Lemonldap::NG::Common::Conf->new( type => 'bad' ) == 0
and $Lemonldap::NG::Common::Conf::msg =~
/Error: Unknown package Lemonldap::NG::Common::Conf::bad$/
),
'Bad module'
);
$h = bless {}, 'Lemonldap::NG::Common::Conf';
ok( $h->_readConfFile('storage.conf'), 'Read storage.conf' );
......@@ -14,12 +14,14 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
# its man page ( perldoc Test::More ) for help writing this test script.
my $h;
@ARGV = ("help=groups");
ok(
$h = new Lemonldap::NG::Common::Conf(
{
type => 'File',
dirName => ".",
}
)
),
'type => file',
);
Supports Markdown
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