/[transports]/trunk/t/00-model-Landscape.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 /trunk/t/00-model-Landscape.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 51 - (hide annotations)
Mon Jun 5 14:06:58 2006 UTC (17 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1347 byte(s)
added landscapes (collection of source and destination clients) to the mix
instead of specifing users for sources (and destinations which wasn't
implemented anyway)
1 dpavlin 51 #!/usr/bin/perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the Landscape model.
8    
9     =cut
10    
11     use Jifty::Test tests => 11;
12    
13     my $nr = 3;
14    
15     # Make sure we can load the model
16     use_ok('Transports::Model::Landscape');
17    
18     # Grab a system use
19     my $system_user = Transports::CurrentUser->superuser;
20     ok($system_user, "Found a system user");
21    
22     # Try testing a create
23     my $o = Transports::Model::Landscape->new(current_user => $system_user);
24     my ($id) = $o->create(
25     name => 'foo',
26     );
27     ok($id, "Landscape create returned success");
28     ok($o->id, "New Landscape has valid id set");
29     is($o->id, $id, "Create returned the right id");
30    
31     # And another
32     $o->create(
33     name => 'bar',
34     );
35     ok($o->id, "Landscape create returned another value");
36     isnt($o->id, $id, "And it is different from the previous one");
37    
38     # Searches in general
39     my $collection = Transports::Model::LandscapeCollection->new(current_user => $system_user);
40     $collection->unlimit;
41     is($collection->count, $nr + 2, "Finds two records");
42    
43     # Searches in specific
44     $collection->limit(column => 'id', value => $o->id);
45     is($collection->count, 1, "Finds one record with specific id");
46    
47     # Delete one of them
48     $o->delete;
49     $collection->redo_search;
50     is($collection->count, 0, "Deleted row is gone");
51    
52     # And the other one is still there
53     $collection->unlimit;
54     is($collection->count, $nr + 1, "Still one left");
55    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26