mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-04 14:19:23 +00:00
The beginnings of a testing framework.
This commit is contained in:
parent
487c53d838
commit
046e390380
108
testing/dav_test
Executable file
108
testing/dav_test
Executable file
@ -0,0 +1,108 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Run a test
|
||||
#
|
||||
|
||||
my $suite=$ARGV[0];
|
||||
my $test=$ARGV[1];
|
||||
|
||||
usage() unless ( defined($suite) && defined($test) );
|
||||
|
||||
my @arguments = ( "--basic", "--user", "andrew:x", "--proxy", "", "--silent" );
|
||||
push @arguments, "--verbose" if ( defined($ARGV[2]) );
|
||||
|
||||
my $url;
|
||||
|
||||
my $datafile = "tests/$suite/$test.data";
|
||||
|
||||
open( TEST, '<', "tests/$suite/$test.test" ) or die "Can't open 'tests/$suite/$test.test'";
|
||||
while( <TEST> ) {
|
||||
/^\s*(#|$)/ && next;
|
||||
|
||||
/^\s*HEAD\s*(#|$|=)/ && do {
|
||||
push @arguments, "--include";
|
||||
};
|
||||
|
||||
/^\s*DATA\s*=\s*(\S.*)$/ && do {
|
||||
$datafile="tests/$suite/$1.data";
|
||||
};
|
||||
|
||||
/^\s*VERBOSE\s*(#|$|=)/ && do {
|
||||
push @arguments, "--verbose";
|
||||
};
|
||||
|
||||
/^\s*TYPE\s*=\s*(\S.*)$/ && do {
|
||||
push @arguments, "--request", $1;
|
||||
};
|
||||
|
||||
/^\s*HEADER\s*=\s*(\S.*)$/ && do {
|
||||
push @arguments, "--header", $1;
|
||||
};
|
||||
|
||||
/^\s*URL\s*=\s*(\S.*)$/ && do {
|
||||
$url=$1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
if ( !defined($url) ) {
|
||||
print <<EOERROR ;
|
||||
The .test file must contain a URL. It may also contain a TYPE line (to
|
||||
specify the request type, such as PROPFIND, MKCOL, PUT etc) and it may
|
||||
contain a number of HEADER lines to specify additional headers to send
|
||||
along with the request.
|
||||
EOERROR
|
||||
exit (2);
|
||||
}
|
||||
|
||||
if ( -f $datafile ) {
|
||||
push @arguments, "--data-binary", "\@$datafile";
|
||||
# print "Using datafile: ", $datafile,"\n";
|
||||
}
|
||||
else {
|
||||
undef($datafile);
|
||||
}
|
||||
|
||||
|
||||
# print @arguments;
|
||||
# print "\n";
|
||||
push @arguments, $url;
|
||||
|
||||
open RESULTS, "-|", "curl", @arguments;
|
||||
while( <RESULTS> ) {
|
||||
print;
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
sub usage {
|
||||
print <<EOERROR ;
|
||||
|
||||
Usage: dav_test <testsuite> <testname>
|
||||
|
||||
This program will read the file 'tests/<testsuite>/<testname>.test
|
||||
and follow the instructions there. Those instructions will include
|
||||
lines defining the test like:
|
||||
=================================================
|
||||
# This is an example
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEADER=Depth: 0
|
||||
HEADER=Content-type: text/xml
|
||||
TYPE=PROPFIND
|
||||
VERBOSE
|
||||
DATA=OTHERTEST
|
||||
=================================================
|
||||
|
||||
URL The URL to request from.
|
||||
HEADER An additional header for the request
|
||||
TYPE The type of request (e.g. GET/PUT/POST/REPORT/...)
|
||||
HEAD Whether to include the headers in the recorded response
|
||||
VERBOSE Whether to provide the full request / response headers.
|
||||
DATA The name of a different test in this suite to use data from.
|
||||
|
||||
Additionally, if a file 'tests/<testsuite>/<testname>.data' exists
|
||||
the contents of that file will be sent in the body of the request.
|
||||
|
||||
EOERROR
|
||||
exit(1);
|
||||
}
|
||||
6
testing/tests/chandler/OPTIONS-dotchandler.test
Normal file
6
testing/tests/chandler/OPTIONS-dotchandler.test
Normal file
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Test the initial OPTIONS for the root
|
||||
#
|
||||
TYPE=OPTIONS
|
||||
URL=http://mycaldav/caldav.php/andrew/.chandler/
|
||||
HEAD
|
||||
6
testing/tests/chandler/OPTIONS-top.test
Normal file
6
testing/tests/chandler/OPTIONS-top.test
Normal file
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Test the initial OPTIONS for the root
|
||||
#
|
||||
TYPE=OPTIONS
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEAD
|
||||
8
testing/tests/chandler/PROPFIND-dotchandler.test
Normal file
8
testing/tests/chandler/PROPFIND-dotchandler.test
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 0
|
||||
URL=http://mycaldav/caldav.php/andrew/.chandler/
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
DATA=PROPFIND
|
||||
2
testing/tests/chandler/PROPFIND.data
Normal file
2
testing/tests/chandler/PROPFIND.data
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<ns0:propfind xmlns:ns0="DAV:"><ns0:prop><ns0:getetag /><ns0:resourcetype /><ns0:displayname /></ns0:prop></ns0:propfind>
|
||||
7
testing/tests/chandler/PROPFIND.test
Normal file
7
testing/tests/chandler/PROPFIND.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 0
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
9
testing/tests/chandler/PROPFIND1.test
Normal file
9
testing/tests/chandler/PROPFIND1.test
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 0
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
DATA=PROPFIND
|
||||
HEAD
|
||||
9
testing/tests/chandler/PROPFIND2.test
Normal file
9
testing/tests/chandler/PROPFIND2.test
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 1
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
URL=http://mycaldav/caldav.php/
|
||||
DATA=PROPFIND
|
||||
HEAD
|
||||
7
testing/tests/chandler/REPORT.test
Normal file
7
testing/tests/chandler/REPORT.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the REPORT request from Mulberry
|
||||
#
|
||||
TYPE=REPORT
|
||||
HEADER=Content-Type: text/xml; charset=utf-8
|
||||
URL=http://mycaldav/caldav.php/andrew/mulberry/
|
||||
HEAD
|
||||
2
testing/tests/chandler/privilege.data
Normal file
2
testing/tests/chandler/privilege.data
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<ns0:propfind xmlns:ns0="DAV:"><ns0:prop><ns0:current-user-privilege-set /><ns0:getetag /><ns0:resourcetype /><ns0:displayname /></ns0:prop></ns0:propfind>
|
||||
7
testing/tests/chandler/privilege.test
Normal file
7
testing/tests/chandler/privilege.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 0
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
2
testing/tests/chandler/ticketdiscovery.data
Normal file
2
testing/tests/chandler/ticketdiscovery.data
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<ns0:propfind xmlns:ns0="DAV:"><ns0:prop><ns1:ticketdiscovery xmlns:ns1="http://www.xythos.com/namespaces/StorageServer" /><ns0:getetag /><ns0:resourcetype /><ns0:displayname /></ns0:prop></ns0:propfind>
|
||||
7
testing/tests/chandler/ticketdiscovery.test
Normal file
7
testing/tests/chandler/ticketdiscovery.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the initial PROPFIND for the root.
|
||||
#
|
||||
TYPE=PROPFIND
|
||||
HEADER=Depth: 0
|
||||
HEADER=Content-Type: text/xml; charset="utf-8"
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
6
testing/tests/evolution/OPTIONS.test
Normal file
6
testing/tests/evolution/OPTIONS.test
Normal file
@ -0,0 +1,6 @@
|
||||
#
|
||||
# Test the initial OPTIONS for the root
|
||||
#
|
||||
TYPE=OPTIONS
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEAD
|
||||
12
testing/tests/evolution/REPORT.data
Normal file
12
testing/tests/evolution/REPORT.data
Normal file
@ -0,0 +1,12 @@
|
||||
<C:calendar-query xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:D="DAV:">
|
||||
<D:prop>
|
||||
<D:getetag/>
|
||||
</D:prop>
|
||||
<C:filter>
|
||||
<C:comp-filter name="VCALENDAR">
|
||||
<C:comp-filter name="VEVENT">
|
||||
<C:is-defined/>
|
||||
</C:comp-filter>
|
||||
</C:comp-filter>
|
||||
</C:filter>
|
||||
</C:calendar-query>
|
||||
7
testing/tests/evolution/REPORT.test
Normal file
7
testing/tests/evolution/REPORT.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the REPORT request
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEADER=Content-Type: text/xml
|
||||
HEAD
|
||||
8
testing/tests/mulberry/PROPFIND-initial.data
Normal file
8
testing/tests/mulberry/PROPFIND-initial.data
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<D:propfind xmlns:D="DAV:">
|
||||
<D:prop>
|
||||
<D:getcontentlength/>
|
||||
<D:getcontenttype/>
|
||||
<D:resourcetype/>
|
||||
</D:prop>
|
||||
</D:propfind>
|
||||
7
testing/tests/mulberry/PROPFIND-initial.test
Normal file
7
testing/tests/mulberry/PROPFIND-initial.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# After creating a calendar in Mulberry, we should be able
|
||||
# to do a PROPFIND and discover it.
|
||||
TYPE=PROPFIND
|
||||
URL=http://mycaldav/caldav.php/andrew/
|
||||
HEADER=Depth: 1
|
||||
HEADER=Content-Type: text/xml; charset=utf-8
|
||||
9
testing/tests/mulberry/PROPFIND-mulberry.data
Normal file
9
testing/tests/mulberry/PROPFIND-mulberry.data
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<D:propfind xmlns:D="DAV:">
|
||||
<D:prop>
|
||||
<D:getcontentlength/>
|
||||
<D:getcontenttype/>
|
||||
<D:resourcetype/>
|
||||
<D:getetag/>
|
||||
</D:prop>
|
||||
</D:propfind>
|
||||
7
testing/tests/mulberry/PROPFIND-mulberry.test
Normal file
7
testing/tests/mulberry/PROPFIND-mulberry.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# After creating a calendar in Mulberry, we should be able
|
||||
# to do a PROPFIND and discover it.
|
||||
TYPE=PROPFIND
|
||||
URL=http://mycaldav/caldav.php/andrew/mulberry/
|
||||
HEADER=Depth: 1
|
||||
HEADER=Content-Type: text/xml; charset=utf-8
|
||||
31
testing/tests/mulberry/PUT1.data
Normal file
31
testing/tests/mulberry/PUT1.data
Normal file
@ -0,0 +1,31 @@
|
||||
BEGIN:VCALENDAR
|
||||
CALSCALE:GREGORIAN
|
||||
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
|
||||
VERSION:2.0
|
||||
BEGIN:VTIMEZONE
|
||||
LAST-MODIFIED:20040110T032845Z
|
||||
TZID:New Zealand Standard Time
|
||||
X-LIC-LOCATION:Pacific/Auckland
|
||||
BEGIN:DAYLIGHT
|
||||
DTSTART:20000404T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
|
||||
TZNAME:NZDT
|
||||
TZOFFSETFROM:+1200
|
||||
TZOFFSETTO:+1300
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
DTSTART:20001026T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10
|
||||
TZNAME:NZST
|
||||
TZOFFSETFROM:+1300
|
||||
TZOFFSETTO:+1200
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
DTSTAMP:20061004T072647Z
|
||||
DTSTART;TZID=New Zealand Standard Time:20061004T111500
|
||||
DURATION:PT1H
|
||||
SUMMARY:A new event
|
||||
UID:73CEA660B2AB08BE90C9D6B5@D76FAF7B10D9E8D2D41F779C
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
7
testing/tests/mulberry/PUT1.test
Normal file
7
testing/tests/mulberry/PUT1.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# PUT a calendar entry into the Mulberry calendar
|
||||
#
|
||||
TYPE=PUT
|
||||
URL=http://mycaldav/caldav.php/andrew/mulberry/30A56217E5719B1453D1942F83106C7A-0.ics
|
||||
HEADER=Content-Type: text/calendar; charset=utf-8
|
||||
HEAD
|
||||
33
testing/tests/mulberry/PUT2.data
Normal file
33
testing/tests/mulberry/PUT2.data
Normal file
@ -0,0 +1,33 @@
|
||||
BEGIN:VCALENDAR
|
||||
CALSCALE:GREGORIAN
|
||||
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
|
||||
VERSION:2.0
|
||||
BEGIN:VTIMEZONE
|
||||
LAST-MODIFIED:20040110T032845Z
|
||||
TZID:New Zealand Standard Time
|
||||
X-LIC-LOCATION:Pacific/Auckland
|
||||
BEGIN:DAYLIGHT
|
||||
DTSTART:20000404T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
|
||||
TZNAME:NZDT
|
||||
TZOFFSETFROM:+1200
|
||||
TZOFFSETTO:+1300
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
DTSTART:20001026T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=10
|
||||
TZNAME:NZST
|
||||
TZOFFSETFROM:+1300
|
||||
TZOFFSETTO:+1200
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Weigh a pie
|
||||
DTSTAMP:20061004T102416Z
|
||||
DTSTART;TZID=New Zealand Standard Time:20061004T110000
|
||||
DURATION:PT1H
|
||||
LOCATION:Somewhere over the rainbow
|
||||
SUMMARY:11am on Wednesday\, 4th
|
||||
UID:A1E59F7D54EF85BE2A7E6900@CA1CBED546AAE36FF3BC722E
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
7
testing/tests/mulberry/PUT2.test
Normal file
7
testing/tests/mulberry/PUT2.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# PUT a calendar entry into the Mulberry calendar
|
||||
#
|
||||
TYPE=PUT
|
||||
URL=http://mycaldav/caldav.php/andrew/mulberry/F91ACE37725E396C1A4BB87568CE36C0-0.ics
|
||||
HEADER=Content-Type: text/calendar; charset=utf-8
|
||||
HEAD
|
||||
9
testing/tests/mulberry/REPORT-1href.data
Normal file
9
testing/tests/mulberry/REPORT-1href.data
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<D:prop>
|
||||
<D:getetag/>
|
||||
<C:calendar-data/>
|
||||
</D:prop>
|
||||
<D:href>/caldav.php/andrew/mulberry/30A56217E5719B1453D1942F83106C7A-0.ics</D:href>
|
||||
<D:href>/caldav.php/andrew/mulberry/F91ACE37725E396C1A4BB87568CE36C0-0.ics</D:href>
|
||||
</C:calendar-multiget>
|
||||
7
testing/tests/mulberry/REPORT-1href.test
Normal file
7
testing/tests/mulberry/REPORT-1href.test
Normal file
@ -0,0 +1,7 @@
|
||||
#
|
||||
# Test the REPORT request
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://mycaldav/caldav.php/andrew/mulberry/
|
||||
HEADER=Content-Type: text/xml; charset=utf-8
|
||||
HEAD
|
||||
Loading…
x
Reference in New Issue
Block a user