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

Contents of /trunk/t/00-model-UserOnLandscape.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (show annotations)
Mon Jun 5 14:14:19 2006 UTC (17 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1421 byte(s)
tweak tests for bootstrap data and add all values to create calls so that they don't fail
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 =head1 DESCRIPTION
6
7 A basic test harness for the UserOnLandscape 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::UserOnLandscape');
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::UserOnLandscape->new(current_user => $system_user);
24 my ($id) = $o->create(
25 user_on => 1,
26 landscape => 1,
27 );
28 ok($id, "UserOnLandscape create returned success");
29 ok($o->id, "New UserOnLandscape has valid id set");
30 is($o->id, $id, "Create returned the right id");
31
32 # And another
33 $o->create(
34 user_on => 2,
35 landscape => 2,
36 );
37 ok($o->id, "UserOnLandscape create returned another value");
38 isnt($o->id, $id, "And it is different from the previous one");
39
40 # Searches in general
41 my $collection = Transports::Model::UserOnLandscapeCollection->new(current_user => $system_user);
42 $collection->unlimit;
43 is($collection->count, $nr + 2, "Finds two records");
44
45 # Searches in specific
46 $collection->limit(column => 'id', value => $o->id);
47 is($collection->count, 1, "Finds one record with specific id");
48
49 # Delete one of them
50 $o->delete;
51 $collection->redo_search;
52 is($collection->count, 0, "Deleted row is gone");
53
54 # And the other one is still there
55 $collection->unlimit;
56 is($collection->count, $nr + 1, "Still one left");
57

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26