/[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 151 by dpavlin, Tue Jun 3 19:31:36 2008 UTC t/00-model-StrixInstance.t revision 174 by dpavlin, Mon Jun 16 16:48:16 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 => 11;
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( site => 'foo', _dbserver => 'localhost', _dbname => 'foo' );  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( site => 'bar', _dbserver => 'localhost', _dbname => 'bar' );  $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    

Legend:
Removed from v.151  
changed lines
  Added in v.174

  ViewVC Help
Powered by ViewVC 1.1.26