version 1.3, 2010/01/17 21:07:26 |
version 1.4, 2010/01/18 13:47:53 |
|
|
# AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
# AUTHOR: Andrew Fresh (AAF), andrew@cpan.org |
# COMPANY: Red River Communications |
# COMPANY: Red River Communications |
# CREATED: 01/07/10 19:11 |
# CREATED: 01/07/10 19:11 |
# REVISION: $AFresh1: GET.t,v 1.2 2010/01/17 20:18:58 andrew Exp $ |
# REVISION: $AFresh1: GET.t,v 1.3 2010/01/17 21:07:26 andrew Exp $ |
#=============================================================================== |
#=============================================================================== |
|
|
use strict; |
use strict; |
|
|
]; |
]; |
|
|
my @pass = ( |
my @pass = ( |
{ path_info => '/lists', |
{ path_info => '', |
result => ['todo.txt'], |
result => ['todo.txt'], |
}, |
}, |
{ path_info => '/lists/todo', |
{ path_info => '/todo', |
result => $list_should_be, |
result => $list_should_be, |
}, |
}, |
{ path_info => '/lists/todo/list', |
{ path_info => '/todo/list', |
result => $list_should_be, |
result => $list_should_be, |
}, |
}, |
); |
); |
|
|
foreach my $p (@pass) { |
foreach my $p (@pass) { |
my $api = new_ok( $class, |
my $api = new_ok( $class, |
[ { basedir => 't', path_info => $p->{path_info} } ] ); |
[ { todo_dir => 't/lists', path_info => $p->{path_info} } ] ); |
|
|
my @result; |
my @result; |
ok( eval { @result = $api->GET() }, |
ok( eval { @result = $api->GET() }, |
|
|
} |
} |
|
|
my @fail = ( |
my @fail = ( |
{ path_info => '/lists/todo/entry', |
{ path_info => '/todo/entry', |
result => '', |
result => '', |
}, |
}, |
{ path_info => '/lists/todo/unsupported', |
{ path_info => '/todo/unsupported', |
result => 'Unable to handle GET \[unsupported\]', |
result => 'Unable to handle GET \[unsupported\]', |
}, |
}, |
); |
); |
|
|
foreach my $p (@fail) { |
foreach my $p (@fail) { |
my $api = new_ok( $class, |
my $api = new_ok( $class, |
[ { basedir => 't', path_info => $p->{path_info} } ] ); |
[ { todo_dir => 't/lists', path_info => $p->{path_info} } ] ); |
|
|
my $result; |
my $result; |
ok( !eval { $result = $api->GET() }, |
ok( !eval { $result = $api->GET() }, |