File: 30-mock-other.t

package info (click to toggle)
libtest-net-ldap-perl 0.07-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: perl: 2,017; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,306 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!perl -T
use strict;
use warnings;

use Test::More tests => 19;

use Test::Net::LDAP::Mock::Data;

my $data = Test::Net::LDAP::Mock::Data->new;

# Basic
$data->bind_ok();
$data->unbind_ok();
$data->abandon_ok();

# Root DSE
$data->mock_root_dse(
    namingContexts => 'dc=example,dc=com',
    supportedLDAPVersion => 3,
    subschemaSubentry => 'cn=Subscheme',
);

ok my $root_dse = $data->root_dse;
is($root_dse->get_value('namingContexts'), 'dc=example,dc=com');
is($root_dse->get_value('supportedLDAPVersion'), 3);
is($root_dse->get_value('subschemaSubentry'), 'cn=Subscheme');

# Callback - bind
my @callback_args;
my $mesg;

@callback_args = ();

$mesg = $data->bind_ok(callback => sub {
    push @callback_args, \@_;
});

is(scalar(@callback_args), 1);
is(scalar(@{$callback_args[0]}), 1);
cmp_ok($callback_args[0][0], '==', $mesg);

# Callback - unbind
@callback_args = ();

$mesg = $data->unbind_ok(callback => sub {
    push @callback_args, \@_;
});

is(scalar(@callback_args), 1);
is(scalar(@{$callback_args[0]}), 1);
cmp_ok($callback_args[0][0], '==', $mesg);

# Callback - abandon
@callback_args = ();

$mesg = $data->abandon_ok(callback => sub {
    push @callback_args, \@_;
});

is(scalar(@callback_args), 1);
is(scalar(@{$callback_args[0]}), 1);
cmp_ok($callback_args[0][0], '==', $mesg);