File: 5_propfind.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 (62 lines) | stat: -rwxr-xr-x 1,651 bytes parent folder | download | duplicates (10)
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
#!/usr/local/bin/perl -w
use strict;
use HTTP::DAV;
use Test;
use lib 't';
use TestDetails qw($test_user $test_pass $test_url do_test fail_tests test_callback);

# Sends out a propfind request to the server 
# specified in "PROPFIND" in the TestDetails 
# module.

my $TESTS;
$TESTS=9;
plan tests => $TESTS;
fail_tests($TESTS) unless $test_url =~ /http/;

my $dav = HTTP::DAV->new;
HTTP::DAV::DebugLevel(3);

$dav->credentials( $test_user,$test_pass,$test_url );

my $response;
my $resource = $dav->new_resource( -uri => $test_url );

######################################################################
# RUN THE TESTS

ok($resource->set_property('testing','123'));
ok($resource->get_property('testing'),'123');
ok($resource->is_collection(),0);

$response = $resource->propfind();
if (! ok($response->is_success) ) {
   print $response->message() ."\n";
}

ok($resource->is_collection());
ok($resource->get_property('resourcetype'));

$response = $resource->propfind( -depth=>0, "<D:prop><D:lockdiscovery/></D:prop>");
if (! ok($response->is_success) ) {
   print $response->message() ."\n";
}

#use Data::Dumper;
#print Data::Dumper->Dump( [$resource] , [ '$resource' ] );
#print $resource->as_string;


$response = $resource->options();
if (! ok($response->is_success) ) {
   print $response->message() ."\n";
}

#$resource->set_property('supportedlocks',[]);
if ( $resource->is_dav_compliant() eq 2 && $resource->is_option('LOCK') ) {
   my $supportedlocks_arr = $resource->get_property('supportedlocks');
   print "supportedlocks_arr: ". ref($supportedlocks_arr) ."\n";
   ok(1) if ref($supportedlocks_arr) eq "ARRAY";
} else {
   skip 1,1;
}