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

This commit is contained in:
Xavier Guimard 2008-12-26 16:13:36 +00:00
parent ad0ed7f3ba
commit 09f1a45cab
6 changed files with 26 additions and 10 deletions

View File

@ -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

View File

@ -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;

View File

@ -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' );

View File

@ -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',
);