1#!perl
2
3use Test::More tests => 14;
4
5use Authen::SASL qw(Perl);
6
7my $sasl = Authen::SASL->new(
8  mechanism => 'PLAIN',
9  callback => {
10    user => 'gbarr',
11    pass => 'fred',
12    authname => 'none'
13  },
14);
15ok($sasl, 'new');
16
17is($sasl->mechanism, 'PLAIN', 'sasl mechanism');
18
19my $conn = $sasl->client_new("ldap","localhost");
20
21is($conn->mechanism, 'PLAIN', 'conn mechanism');
22ok  $conn->need_step, "we need to *start* at the minimum";
23ok !$conn->is_success, "no success yet";
24ok !$conn->error, "and no error";
25
26is($conn->client_start,  "none\0gbarr\0fred", 'client_start');
27ok !$conn->need_step, "we're done, plain is kinda quick";
28ok  $conn->is_success, "success!";
29ok !$conn->error, "and no error";
30
31is($conn->client_step("xyz"), undef, 'client_step');
32ok !$conn->need_step, "we're done already";
33ok  $conn->is_success, "sucess already";
34ok !$conn->error, "and no error";
35
36
37