Browse Source

* updated tests

master
Alex 'AdUser' Z 10 years ago
parent
commit
9000ccfabd
  1. 10
      t/LDAP.t

10
t/LDAP.t

@ -7,12 +7,12 @@ use utf8;
use LDV::LDAP; use LDV::LDAP;
use File::Slurp; use File::Slurp;
use Data::Dumper; use Data::Dumper;
use Test::More tests => 9; use Test::More tests => 13;
my $hash = read_file('conf/ldv.conf'); my $hash = read_file('conf/ldv.conf');
my $config = eval "$hash"; my $config = eval "$hash";
SKIP: { SKIP: {
skip "Can't load config", 9 unless (ref($config) eq 'HASH'); skip "Can't load config", 13 unless (ref($config) eq 'HASH');
my $ldap = LDV::LDAP->new($config->{ldap}); my $ldap = LDV::LDAP->new($config->{ldap});
isa_ok($ldap, "LDV::LDAP", "LDV::LDAP->new"); isa_ok($ldap, "LDV::LDAP", "LDV::LDAP->new");
@ -30,6 +30,12 @@ SKIP: {
$attrs->{mail} = 'abigvalg@example.com'; $attrs->{mail} = 'abigvalg@example.com';
is_deeply($ldap->get("test20"), $attrs, "getting data of updated user"); is_deeply($ldap->get("test20"), $attrs, "getting data of updated user");
my $pass = '{SSHA}K/LOxZB1fnNtQuRc1mApdoL7CGR2Akn/'; # 'test'
is($ldap->update("test20", {userPassword => $pass}), undef, "updating user password");
is($ldap->auth("test20", "test"), 1, "check auth success");
is($ldap->auth("test20", "test1"), undef, "check auth falure (wrong pass)");
is($ldap->auth("test20", undef), undef, "check auth falure (empty pass)");
is($ldap->delete("test20"), undef, "deleting user"); is($ldap->delete("test20"), undef, "deleting user");
}; };

Loading…
Cancel
Save