/[A3C]/t/10-ldap.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /t/10-ldap.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 36 by dpavlin, Sun Mar 30 00:02:18 2008 UTC revision 112 by dpavlin, Wed May 14 16:50:49 2008 UTC
# Line 8  test LDAP module Line 8  test LDAP module
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 5;  use Jifty::Test tests => 29;
12    use Data::Dump qw/dump/;
13    
14  use_ok('A3C::LDAP');  use_ok('A3C::LDAP');
15    
16    ok( my $ldap = A3C::LDAP->new, 'new' );
17    
18    isa_ok( $ldap, 'A3C::LDAP' );
19    
20    isa_ok( $ldap->objectClass, 'HASH', 'have objectClass' );
21    isa_ok( $ldap->link, 'HASH', 'have link' );
22    
23    diag "objectClass = ",dump( $ldap->objectClass );
24    diag "link = ",dump( $ldap->link );
25    
26  ok(  ok(
27          my $msg = A3C::LDAP->search(          $ldap->search(
28                  base    => 'dc=skole,dc=hr',                  base    => 'dc=skole,dc=hr',
29                  filter  => '(objectClass=hrEduOrg)',                  filter  => '(objectClass=hrEduOrg)',
30                    sizelimit => 10,
31          )          )
32  ), 'search';  ), 'search';
33    
34  diag 'code: ', $msg->code, ' count: ', $msg->count;  isa_ok( $ldap, 'A3C::LDAP' );
35    
36    cmp_ok( $ldap->count, '==', 10, 'count' );
37    
38    foreach my $i ( 1 .. 10 ) {
39            ok( my $entry = $ldap->next, "next $i" );
40    #       $entry->dump;
41    }
42    
43  isa_ok( $msg, 'Net::LDAP::Search' );  my $org_oc = $ldap->objectClass->{organization};
44    
45  is( $msg->code, 0, 'code' );  foreach my $limit ( 3, 7, 14 ) {
46            ok( my $collection = $ldap->collection( $org_oc, limit => $limit), "collection $org_oc limit = $limit" );
47            isa_ok( $collection, "A3C::Model::${org_oc}Collection" );
48            is( $collection->count, $limit, 'count' );
49    }
50    
51  cmp_ok( $msg->count, '>', 1000, 'count' );  my $person_oc = $ldap->objectClass->{person};
52    
53    ok( my $coll = $ldap->collection( $person_oc, filter => '(HrEduPersonHomeOrg=aa-test-zz)'), 'collection with filter' );
54    is( $coll->count, 0, 'no results' );

Legend:
Removed from v.36  
changed lines
  Added in v.112

  ViewVC Help
Powered by ViewVC 1.1.26