01-Common-Conf.t 1.04 KB
Newer Older
Yadd's avatar
Yadd committed
1
2
3
4
5
6
7
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Lemonldap-NG-Manager.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

8
use Test::More tests => 3;
9
BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
Yadd's avatar
Yadd committed
10
11
12

#########################

Christophe Maudoux's avatar
Typo    
Christophe Maudoux committed
13
# Insert your test code below, the Test::More module is used here so read
Yadd's avatar
Yadd committed
14
15
# its man page ( perldoc Test::More ) for help writing this test script.

16
my $h;
17
my $inifile     = "lemonldap-ng.ini";
18
my $confsection = "configuration";
19

20
ok(
21
22
23
    (
        Lemonldap::NG::Common::Conf->new( type => 'bad' ) == 0
          and $Lemonldap::NG::Common::Conf::msg =~
Yadd's avatar
Yadd committed
24
          /Error: Unknown package Lemonldap::NG::Common::Conf::Backends::bad\.$/
25
26
    ),
    'Bad module'
Yadd's avatar
Yadd committed
27
) or print STDERR "Msg: $Lemonldap::NG::Common::Conf::msg\n";
28

29
30
$h = bless {}, 'Lemonldap::NG::Common::Conf';

31
ok(
32
    (
33
34
        %$h = ( %$h, %{ $h->getLocalConf( $confsection, $inifile, 0 ) } )
          and exists $h->{localStorage}
35
36
37
    ),
    "Read $inifile"
);
38