/[Grep]/t/00-action-Fetch.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /t/00-action-Fetch.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 173 by dpavlin, Sat Feb 17 17:10:27 2007 UTC revision 174 by dpavlin, Wed Jul 4 20:45:03 2007 UTC
# Line 8  A (very) basic test harness for the Fetc Line 8  A (very) basic test harness for the Fetc
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 1;  use Jifty::Test tests => 10;
12    
13  # Make sure we can load the action  # Make sure we can load the action
14  use_ok('Grep::Action::Fetch');  use_ok('Grep::Action::Fetch');
15    
16    # Grab a system user
17    my $system_user = Grep::CurrentUser->superuser;
18    ok($system_user, "Found a system user");
19    
20    {
21            use Log::Log4perl::Level;
22            Jifty->web->log->level( $DEBUG );
23    }
24    
25    my $feed = Grep::Model::Feed->new(current_user => $system_user);
26    my ($feed_id) = $feed->create(
27            uri => 'http://saturn.ffzg.hr/noauth/feed/workspace/rot13?search_term=%s',
28            title => 'rot13.org wiki',
29    );
30    ok( $feed_id, 'feed->create' );
31    
32    my $fetch = Jifty::Test->web->new_action(
33        class        => 'Fetch',
34        moniker      => 'fetch',
35        current_user => $system_user,
36        arguments    => {}
37    );
38    
39    isa_ok($fetch, 'Grep::Action::Fetch');
40    
41    my %args = %{$fetch->arguments};
42    
43    ok($args{q}, "Can fetch on q");
44    
45    # fetch on q
46    $fetch->argument_values({ q => 'Grep test page', feed => $feed_id });
47    $fetch->run;
48    
49    my $result = $fetch->result->content('items');
50    
51    isa_ok($result, 'Jifty::Collection');
52    cmp_ok($result->count, '>=', 1, 'count');
53    
54    diag "found ", $result->count, " results";
55    
56    isa_ok( $result->first, 'Grep::Model::Item' );
57    
58    is($result->first->in_feed->id, $feed_id, 'feed id');
59    like($result->first->link, qr#http://saturn.ffzg.hr/rot13#, 'link');
60    
61    $feed->delete;
62    

Legend:
Removed from v.173  
changed lines
  Added in v.174

  ViewVC Help
Powered by ViewVC 1.1.26