Version 1.017
[catagits/Catalyst-Authentication-Store-LDAP.git] / t / 02-realms_api.t
CommitLineData
f66d606b 1#!/usr/bin/perl
2
3use strict;
4use warnings;
f66d606b 5
e385da71 6use Test::More;
f66d606b 7use lib 't/lib';
8use LDAPTest;
9my $server = LDAPTest::spawn_server();
10
11use_ok("Catalyst::Authentication::Store::LDAP::Backend");
12
13my $back = Catalyst::Authentication::Store::LDAP::Backend->new(
14 { 'ldap_server' => LDAPTest::server_host(),
15
16 # can test the timeout SKIP with this
17 'ldap_server_options' =>
18 { timeout => -1, debug => $ENV{PERL_DEBUG} || 0 },
19
20 'binddn' => 'anonymous',
21 'bindpw' => 'dontcarehow',
22 'start_tls' => 0,
23 'user_basedn' => 'ou=foobar',
24 'user_filter' => '(&(objectClass=person)(uid=%s))',
25 'user_scope' => 'one',
26 'user_field' => 'uid',
27 'use_roles' => 0,
28 }
29);
30
18d41a8f 31isa_ok( $back, "Catalyst::Authentication::Store::LDAP::Backend", 'LDAP backed' );
32
33foreach (
34 ['somebody', 'Some Body'],
35 ['sunnO)))', 'Sunn O)))'],
36 ['some*', 'Some Star'],
37) {
38 my ($username, $name) = @$_;
39
40 my $user = $back->find_user( { username => $username } );
41 isa_ok( $user, "Catalyst::Authentication::Store::LDAP::User", "find_user('$username') result" );
42 my $displayname = $user->displayname;
43 is( $displayname, $name, 'Display name' );
44
45}
f66d606b 46
e385da71 47done_testing;