change default value for persist_in_session to username
[catagits/Catalyst-Authentication-Store-LDAP.git] / t / 03-entry_class.t
CommitLineData
f66d606b 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use Catalyst::Exception;
6
e385da71 7use Test::More;
f66d606b 8use lib 't/lib';
9use LDAPTest;
f66d606b 10
e385da71 11eval "use Catalyst::Model::LDAP";
12plan skip_all => "Catalyst::Model::LDAP not installed" if $@;
f66d606b 13
e385da71 14my $server = LDAPTest::spawn_server();
15
16use_ok("Catalyst::Authentication::Store::LDAP::Backend");
17
18my $back = Catalyst::Authentication::Store::LDAP::Backend->new(
19 { 'ldap_server' => LDAPTest::server_host(),
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 'entry_class' => 'EntryClass',
f66d606b 29 }
e385da71 30);
31
32isa_ok( $back, "Catalyst::Authentication::Store::LDAP::Backend" );
33my $user = $back->find_user( { username => 'somebody' } );
34isa_ok( $user, "Catalyst::Authentication::Store::LDAP::User" );
35my $displayname = $user->displayname;
36cmp_ok( $displayname, 'eq', 'Some Body', 'Should be Some Body' );
37
38isa_ok( $user->ldap_entry, "EntryClass", "entry_class works" );
39is( $user->ldap_entry->my_method, 1001, "methods on entry_class works" );
f66d606b 40
e385da71 41done_testing;