[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.7

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.7     ! andrew     10: #     REVISION:  $AFresh1: files.t,v 1.6 2010/01/26 06:03:11 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.6       andrew     29: diag(
                     30:     "Testing GET files $class $Text::Todo::REST::API::Actions::GET::VERSION");
1.1       andrew     31:
1.5       andrew     32: my $api = new_ok( $api_class, [ { todo_dir => 't/lists' } ] );
                     33: my $action = new_ok($class);
1.1       andrew     34:
1.4       andrew     35: my $files;
1.5       andrew     36: ok( $files = $action->get_files(
                     37:         $api->_todo, { file_regex => $api->_file_regex }
                     38:     ),
                     39:     'Get Files'
                     40: );
1.4       andrew     41: is_deeply( $files, ['todo.txt'], 'Got correct file' );
                     42:
                     43: my $response;
1.7     ! andrew     44: ok( $response = $api->GET('/'), 'Get Response Files' );
1.4       andrew     45:
                     46: $files = [];
                     47: ok( $files = $response->data, 'Get response data' );
                     48: is_deeply( $files, ['todo.txt'], 'Got correct file' );
                     49:
                     50: $response = undef;
1.7     ! andrew     51: ok( $response = $api->GET('.txt'), 'Get Files' );
1.4       andrew     52:
                     53: $files = [];
                     54: ok( $files = $response->data, 'Get response data' );
                     55: is_deeply( $files, ['todo.txt'], 'Got correct file' );

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