File: 9_RT_42877.t

package info (click to toggle)
libhttp-dav-perl 0.38-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 512 kB
  • ctags: 406
  • sloc: perl: 3,618; xml: 90; makefile: 35; sh: 20
file content (31 lines) | stat: -rwxr-xr-x 848 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/env perl

use strict;
use Test::More tests => 7;

use_ok('HTTP::DAV');
use_ok('HTTP::DAV::Comms');

$HTTP::DAV::DEBUG =
$HTTP::DAV::DEBUG = 3;

my $netloc = 'mylocation';
my $realm = 'myrealm';
my $user = 'randomuser';
my $pass = '12345';

my $ua = HTTP::DAV::UserAgent->new();
my $existing_credentials = $ua->credentials($netloc, $realm);

is ($existing_credentials, undef, 'No credentials defined at start');
$ua->credentials($netloc, $realm, $user, $pass);

$existing_credentials = $ua->credentials($netloc, $realm);
is ($existing_credentials, "$user:$pass", 'credentials() called in scalar context');

my @cred = $ua->credentials($netloc, $realm);

is(scalar @cred, 2, 'credentials() called in list context');
is($cred[0], $user, 'credentials() called in list context');
is($cred[1], $pass, 'credentials() called in list context');