/[Grep]/t/00-model-Item.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

Annotation of /t/00-model-Item.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (hide annotations)
Sun Feb 18 15:07:03 2007 UTC (17 years, 2 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1245 byte(s)
Bookmarklet is now designed to work on html results page (to capture cookies so that
Grep will later be able to fetch feeds with user credentials creating single sign-on
scenario :-), and it will automatically (using new requirement Feed::Find) find feed
on that page.

For that to work, new action AddFeed was added.
1 dpavlin 2 #!/usr/bin/env perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the Item model.
8    
9     =cut
10    
11     use Jifty::Test tests => 11;
12    
13 dpavlin 21 use blib;
14    
15 dpavlin 2 # Make sure we can load the model
16     use_ok('Grep::Model::Item');
17    
18     # Grab a system user
19     my $system_user = Grep::CurrentUser->superuser;
20     ok($system_user, "Found a system user");
21    
22     # Try testing a create
23     my $o = Grep::Model::Item->new(current_user => $system_user);
24     my ($id) = $o->create();
25     ok($id, "Item create returned success");
26     ok($o->id, "New Item has valid id set");
27     is($o->id, $id, "Create returned the right id");
28    
29     # And another
30     $o->create();
31     ok($o->id, "Item create returned another value");
32     isnt($o->id, $id, "And it is different from the previous one");
33    
34     # Searches in general
35     my $collection = Grep::Model::ItemCollection->new(current_user => $system_user);
36     $collection->unlimit;
37     is($collection->count, 2, "Finds two records");
38    
39     # Searches in specific
40     $collection->limit(column => 'id', value => $o->id);
41     is($collection->count, 1, "Finds one record with specific id");
42    
43     # Delete one of them
44     $o->delete;
45     $collection->redo_search;
46     is($collection->count, 0, "Deleted row is gone");
47    
48     # And the other one is still there
49     $collection->unlimit;
50     is($collection->count, 1, "Still one left");
51    

  ViewVC Help
Powered by ViewVC 1.1.26