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

Diff of /t/00-model-StrixInstance.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

t/00-model-StrixSite.t revision 139 by dpavlin, Fri May 30 21:16:08 2008 UTC t/00-model-StrixInstance.t revision 191 by dpavlin, Tue Jun 17 14:28:10 2008 UTC
# Line 4  use strict; Line 4  use strict;
4    
5  =head1 DESCRIPTION  =head1 DESCRIPTION
6    
7  A basic test harness for the StrixSite model.  A basic test harness for the StrixInstance model.
8    
9  =cut  =cut
10    
11  use Jifty::Test tests => 11;  use Jifty::Test tests => 14;
12    
13  # Make sure we can load the model  # Make sure we can load the model
14  use_ok('A3C::Model::StrixSite');  use_ok('A3C::Model::StrixInstance');
15    
16  # Grab a system user  # Grab a system user
17  my $system_user = A3C::CurrentUser->superuser;  my $system_user = A3C::CurrentUser->superuser;
18  ok($system_user, "Found a system user");  ok($system_user, "Found a system user");
19    
20  # Try testing a create  # Try testing a create
21  my $o = A3C::Model::StrixSite->new(current_user => $system_user);  my $o = A3C::Model::StrixInstance->new(current_user => $system_user);
22  my ($id) = $o->create();  my ($id) = $o->create( instance => 'foo', _dbserver => 'localhost', _dbname => 'foo' );
23  ok($id, "StrixSite create returned success");  ok($id, "StrixInstance create returned success");
24  ok($o->id, "New StrixSite has valid id set");  ok($o->id, "New StrixInstance has valid id set");
25  is($o->id, $id, "Create returned the right id");  is($o->id, $id, "Create returned the right id");
26    
27  # And another  # And another
28  $o->create();  $o->create( instance => 'bar', _dbserver => 'localhost', _dbname => 'bar' );
29  ok($o->id, "StrixSite create returned another value");  ok($o->id, "StrixInstance create returned another value");
30  isnt($o->id, $id, "And it is different from the previous one");  isnt($o->id, $id, "And it is different from the previous one");
31    
32  # Searches in general  # Searches in general
33  my $collection =  A3C::Model::StrixSiteCollection->new(current_user => $system_user);  my $collection =  A3C::Model::StrixInstanceCollection->new(current_user => $system_user);
34  $collection->unlimit;  $collection->unlimit;
35  is($collection->count, 2, "Finds two records");  is($collection->count, 2, "Finds two records");
36    
# Line 47  is($collection->count, 0, "Deleted row i Line 47  is($collection->count, 0, "Deleted row i
47  $collection->unlimit;  $collection->unlimit;
48  is($collection->count, 1, "Still one left");  is($collection->count, 1, "Still one left");
49    
50    my $site = A3C::Model::StrixSite->new(current_user => $system_user);
51    ok($site->create(
52            'instance' => 'bar',
53            'naziv' => "Naziv 42",
54            'admin_mail' => "Admin mail",
55            'id' => 42,
56    ), 'site');
57    ok($site->create(
58            'instance' => 'bar',
59            'naziv' => "Naziv 43",
60            'admin_mail' => "Admin mail",
61            'id' => 43,
62    ), 'site');
63    
64    is( $o->has_sites->count, 2 ,'has_sites' );

Legend:
Removed from v.139  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.26