Annotation of todotxt/Text-Todo-REST-API/t/GET/files.t, Revision 1.6
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.6 ! andrew 10: # REVISION: $AFresh1: files.t,v 1.5 2010/01/26 04:30:13 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;
44: ok( $response = $api->GET('.txt'), 'Get Response Files' );
45:
46: $files = [];
47: ok( $files = $response->data, 'Get response data' );
48: is_deeply( $files, ['todo.txt'], 'Got correct file' );
49:
50: $response = undef;
51: ok( $response = $api->GET('/todo_file/files.txt'), 'Get Files' );
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>