Version 1.017
[catagits/Catalyst-Authentication-Store-LDAP.git] / t / 03-entry_class.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;
f66d606b 9
e385da71 10eval "use Catalyst::Model::LDAP";
11plan skip_all => "Catalyst::Model::LDAP not installed" if $@;
f66d606b 12
e385da71 13my $server = LDAPTest::spawn_server();
14
15use_ok("Catalyst::Authentication::Store::LDAP::Backend");
16
17my $back = Catalyst::Authentication::Store::LDAP::Backend->new(
18 { 'ldap_server' => LDAPTest::server_host(),
19 'binddn' => 'anonymous',
20 'bindpw' => 'dontcarehow',
21 'start_tls' => 0,
22 'user_basedn' => 'ou=foobar',
23 'user_filter' => '(&(objectClass=person)(uid=%s))',
24 'user_scope' => 'one',
25 'user_field' => 'uid',
26 'use_roles' => 0,
27 'entry_class' => 'EntryClass',
f66d606b 28 }
e385da71 29);
30
31isa_ok( $back, "Catalyst::Authentication::Store::LDAP::Backend" );
32my $user = $back->find_user( { username => 'somebody' } );
33isa_ok( $user, "Catalyst::Authentication::Store::LDAP::User" );
34my $displayname = $user->displayname;
35cmp_ok( $displayname, 'eq', 'Some Body', 'Should be Some Body' );
36
37isa_ok( $user->ldap_entry, "EntryClass", "entry_class works" );
38is( $user->ldap_entry->my_method, 1001, "methods on entry_class works" );
f66d606b 39
e385da71 40done_testing;