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

Annotation of todotxt/Text-Todo-REST-API/t/GET/files.t, Revision 1.5

1.1       andrew      1: #===============================================================================
                      2: #
                      3: #         FILE:  GET/files.t
                      4: #
                      5: #  DESCRIPTION:  Test Text::Todo::REST::API
                      6: #
                      7: #       AUTHOR:  Andrew Fresh (AAF), andrew@cpan.org
                      8: #      COMPANY:  Red River Communications
                      9: #      CREATED:  01/07/10 19:11
1.5     ! andrew     10: #     REVISION:  $AFresh1: files.t,v 1.4 2010/01/24 04:38:21 andrew Exp $
1.1       andrew     11: #===============================================================================
                     12:
                     13: use strict;
                     14: use warnings;
                     15:
1.5     ! andrew     16: use Test::More tests => 12;
1.1       andrew     17:
1.5     ! andrew     18: my $api_class;
1.1       andrew     19: my $class;
                     20:
                     21: BEGIN {
1.5     ! andrew     22:     $api_class = 'Text::Todo::REST::API';
        !            23:     $class     = 'Text::Todo::REST::API::Actions::GET';
        !            24:
        !            25:     use_ok( $api_class, "use $api_class" );
        !            26:     use_ok( $class,     "use $class" );
1.1       andrew     27: }
                     28:
1.5     ! andrew     29: diag("Testing GET files $class $Text::Todo::REST::API::Actions::GET::VERSION");
1.1       andrew     30:
1.5     ! andrew     31: my $api = new_ok( $api_class, [ { todo_dir => 't/lists' } ] );
        !            32: my $action = new_ok($class);
1.1       andrew     33:
1.4       andrew     34: my $files;
1.5     ! andrew     35: ok( $files = $action->get_files(
        !            36:         $api->_todo, { file_regex => $api->_file_regex }
        !            37:     ),
        !            38:     'Get Files'
        !            39: );
1.4       andrew     40: is_deeply( $files, ['todo.txt'], 'Got correct file' );
                     41:
                     42: my $response;
                     43: ok( $response = $api->GET('.txt'), 'Get Response Files' );
                     44:
                     45: $files = [];
                     46: ok( $files = $response->data, 'Get response data' );
                     47: is_deeply( $files, ['todo.txt'], 'Got correct file' );
                     48:
                     49: $response = undef;
                     50: ok( $response = $api->GET('/todo_file/files.txt'), 'Get Files' );
                     51:
                     52: $files = [];
                     53: ok( $files = $response->data, 'Get response data' );
                     54: is_deeply( $files, ['todo.txt'], 'Got correct file' );

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