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

Annotation of todotxt/Text-Todo-REST-API/t/GET/entry.t, Revision 1.2

1.1       andrew      1: #===============================================================================
                      2: #
                      3: #         FILE:  GET/entry.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.2     ! andrew     10: #     REVISION:  $AFresh1: entry.t,v 1.1 2010/01/17 19:41:24 andrew Exp $
1.1       andrew     11: #===============================================================================
                     12:
                     13: use strict;
                     14: use warnings;
                     15:
                     16: use Test::More tests => 26;
                     17:
                     18: my $class;
                     19: BEGIN {
                     20:     $class = 'Text::Todo::REST::API';
                     21:     use_ok( $class, "use $class" );
                     22: }
                     23:
                     24: diag("Testing GET entry $class $Text::Todo::REST::API::VERSION");
                     25:
1.2     ! andrew     26: my $api = new_ok( $class, [ { todo_dir => 't/lists', path_info => '/todo' } ] );
1.1       andrew     27:
                     28: my $list_should_be = [
                     29:     {   'text' => '(A) entry 1 @one +uno',
                     30:         'md5'  => '931e0831c31a70928b29de55778dc294',
                     31:         'line' => 1
                     32:     },
                     33:     {   'text' => 'entry 2 @two +dos',
                     34:         'md5'  => 'b38dde8029c047e81379d9de581a6251',
                     35:         'line' => 2
                     36:     },
                     37:     {   'text' => '',
                     38:         'md5'  => 'd41d8cd98f00b204e9800998ecf8427e',
                     39:         'line' => 3
                     40:     },
                     41:     {   'text' => 'x completed entry 4',
                     42:         'md5'  => '8de0a2b65a50d5e30e84ad48af46fa78',
                     43:         'line' => 4
                     44:     },
                     45:     {   'text' => '(B) entry 5 is priority',
                     46:         'md5'  => 'c1692dfbf3b5829b6bce44b1a1614980',
                     47:         'line' => 5
                     48:     },
                     49:     {   'text' => 'entry 6 +delete',
                     50:         'md5'  => 'e1f6bf867f75aa019063782554407d02',
                     51:         'line' => 6
                     52:     }
                     53: ];
                     54:
                     55: foreach my $e ( @{$list_should_be} ) {
                     56:     my $entry;
                     57:     ok( $entry = $api->get_entry( $e->{line} ),
                     58:         "get_entry by line ($e->{line})"
                     59:     );
                     60:     is_deeply( $entry, $e, 'got correct entry' );
                     61:
                     62:     $entry = undef;
                     63:     ok( $entry = $api->get_entry( $e->{md5} ),
                     64:         "get_entry by md5 ($e->{md5})"
                     65:     );
                     66:     is_deeply( $entry, $e, 'got correct entry' );
                     67:
                     68: }

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