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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations)
Fri May 26 23:25:35 2006 UTC (17 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1395 byte(s)
added users list and simple edit form for user, check current_user->admin to
grant permissions
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 =head1 DESCRIPTION
6
7 A basic test harness for the UserOnSource model.
8
9 =cut
10
11 use Jifty::Test tests => 11;
12
13 my $nr = 9;
14
15 # Make sure we can load the model
16 use_ok('Transports::Model::UserOnSource');
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::UserOnSource->new(current_user => $system_user);
24 my ($id) = $o->create(
25 user_on => 1,
26 source => 1,
27 );
28 ok($id, "UserOnSource create returned success");
29 ok($o->id, "New UserOnSource 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 source => 2,
36
37 );
38 ok($o->id, "UserOnSource create returned another value");
39 isnt($o->id, $id, "And it is different from the previous one");
40
41 # Searches in general
42 my $collection = Transports::Model::UserOnSourceCollection->new(current_user => $system_user);
43 $collection->unlimit;
44 is($collection->count, $nr + 2, "Finds two records");
45
46 # Searches in specific
47 $collection->limit(column => 'id', value => $o->id);
48 is($collection->count, 1, "Finds one record with specific id");
49
50 # Delete one of them
51 $o->delete;
52 $collection->redo_search;
53 is($collection->count, 0, "Deleted row is gone");
54
55 # And the other one is still there
56 $collection->unlimit;
57 is($collection->count, $nr + 1, "Still one left");
58

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26