[BACK]Return to list.t CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo-REST-API / t / GET

Diff for /todotxt/Text-Todo-REST-API/t/GET/list.t between version 1.3 and 1.8

version 1.3, 2010/01/23 07:15:40 version 1.8, 2010/01/31 03:10:39
Line 7 
Line 7 
 #       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: list.t,v 1.2 2010/01/18 13:47:53 andrew Exp $  #     REVISION:  $AFresh1: list.t,v 1.7 2010/01/26 06:03:11 andrew Exp $
 #===============================================================================  #===============================================================================
   
 use strict;  use strict;
 use warnings;  use warnings;
   
 use Test::More tests => 17;  use Test::More tests => 59;
   
   my $api_class;
 my $class;  my $class;
   
 BEGIN {  BEGIN {
     $class = 'Text::Todo::REST::API';      $api_class = 'Text::Todo::REST::API';
     use_ok( $class, "use $class" );      $class     = 'Text::Todo::REST::API::Actions::GET';
   
       use_ok( $api_class, "use $api_class" );
       use_ok( $class,     "use $class" );
 }  }
   
 diag("Testing GET list $class $Text::Todo::REST::API::VERSION");  diag("Testing GET list $class $Text::Todo::REST::API::Actions::GET::VERSION");
   
 my $api = new_ok( $class, [ { todo_dir => 't/lists' } ] );  my $api = new_ok( $api_class, [ { todo_dir => 't/lists' } ] );
   my $action = new_ok($class);
   
 my $list_should_be = [  my $list_should_be = [
     {   'text' => '(A) entry 1 @one +uno',      {   'text' => '(A) entry 1 @one +uno',
Line 53 
Line 58 
     }      }
 ];  ];
   
 my @list;  my $list;
 ok( @list = $api->get_list( $api->_todo), 'get_list' );  ok( $list = $action->get_list( $api->_todo ), 'get_list' );
 is( scalar @list, 6, 'list is right length' );  is( scalar @{$list}, 6, 'list is right length' );
 is_deeply( \@list, $list_should_be, 'check that we got the right list' );  is_deeply( $list, $list_should_be, 'check that we got the right list' );
   
 foreach my $arg (  foreach my $arg (
     'todo_file', '/todo_file/list',      { list => undef, action => 'list', args => [] },
     { path => '/todo_file/list' },  
       'todo_file', '/todo_file/',
       { path => '/todo_file/' },
     { list => 'todo_file', action => 'list', args => [] },      { list => 'todo_file', action => 'list', args => [] },
   
       'todo', '/todo/',
       { path => '/todo/' },
       { list => 'todo', action => 'list', args => [] },
   
       'todo.txt', '/todo.txt/',
       { path => '/todo.txt/' },
       { list => 'todo.txt', action => 'list', args => [] },
     )      )
 {  {
     my @list;      my $response;
     ok( @list = $api->GET($arg), "GET($arg)" );      ok( $response = $api->GET($arg), "GET($arg)" );
     is( scalar @list, 6, 'list is right length' );      my $list;
     is_deeply( \@list, $list_should_be, 'check that we got the right list' );      ok( $list = $response->data, 'Get response data' );
       is( scalar @{$list}, 6, 'list is right length' );
       is_deeply( $list, $list_should_be, 'check that we got the right list' );
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>