/[A3C]/t/00-model-StrixSite.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-StrixSite.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 190 - (hide annotations)
Tue Jun 17 14:27:00 2008 UTC (15 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1448 byte(s)
added StrixSite local model to hold all strix sites
1 dpavlin 190 #!/usr/bin/env perl
2     use warnings;
3     use strict;
4    
5     =head1 DESCRIPTION
6    
7     A basic test harness for the StrixSite model.
8    
9     =cut
10    
11     use Jifty::Test tests => 11;
12    
13     # Make sure we can load the model
14     use_ok('A3C::Model::StrixSite');
15    
16     # Grab a system user
17     my $system_user = A3C::CurrentUser->superuser;
18     ok($system_user, "Found a system user");
19    
20     # Try testing a create
21     my $o = A3C::Model::StrixSite->new(current_user => $system_user);
22     my ($id) = $o->create(
23     'instance' => 'foo',
24     'naziv' => "Naziv",
25     'admin_mail' => "Admin mail",
26     'id' => 42,
27     );
28     ok($id, "StrixSite create returned success");
29     ok($o->id, "New StrixSite has valid id set");
30     is($o->id, $id, "Create returned the right id");
31    
32     # And another
33     $o->create(
34     'instance' => 'bar',
35     'naziv' => "Naziv",
36     'admin_mail' => "Admin mail",
37     'id' => 43,
38     );
39     ok($o->id, "StrixSite create returned another value");
40     isnt($o->id, $id, "And it is different from the previous one");
41    
42     # Searches in general
43     my $collection = A3C::Model::StrixSiteCollection->new(current_user => $system_user);
44     $collection->unlimit;
45     is($collection->count, 2, "Finds two records");
46    
47     # Searches in specific
48     $collection->limit(column => 'id', value => $o->id);
49     is($collection->count, 1, "Finds one record with specific id");
50    
51     # Delete one of them
52     $o->delete;
53     $collection->redo_search;
54     is($collection->count, 0, "Deleted row is gone");
55    
56     # And the other one is still there
57     $collection->unlimit;
58     is($collection->count, 1, "Still one left");

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26