Permalink
Browse files

first pass of a test suite -- database level

  • Loading branch information...
1 parent c49434d commit 49dbd18cd26a556e19472f2d9f29fbf2dcadfe3c @joellimardo joellimardo committed Oct 19, 2011
View
5 Spine/lib/Apache2/SPINE/Log.pm
@@ -60,15 +60,16 @@ sub handler
my $location = $r->location;
$file =~ s/^$location\/?//mx;
$file ||= $main;
- $file =~ s/^(.*?)\/.*$/$1/mxg;
+ #modified by JL Oct-17-2011 since files can have / slashes
+ #$file =~ s/^(.*?)\/.*$/$1/mxg;
my $in = $r->headers_in();
my $content_dbi = SPINE::DBI::Content->new($dbh);
my $content = shift @ { $content_dbi->get( { name => $file } ) };
if (!$content) { return DONE; }
if (!$content->logging) { return DONE; }
my (@data) =
#$name,$date,$useragent,$remoteaddr,$referer,$query) =
- ($file,$date,$in->{'User-Agent'},$req->connection->remote_host,$in->{"Referer"},scalar($r->args));
+ ($file,$date,$in->{'User-Agent'},$req->connection->remote_ip,$in->{"Referer"},scalar($r->args));
my $add = "insert into statistics (name, sdate, useragent, remoteaddr, referer, query) values ( \'".join(qq(','),@data)."\')";
my $sth = $dbh->prepare($add);
$sth->execute();
View
2 Spine/lib/SPINE/DBI/Base.pm
@@ -75,7 +75,7 @@ sub get
delete($params{'sort'});
$searchtype = $params{'searchtype'} || 'AND';
delete($params{'searchtype'});
- $count = $params{'count'};
+ $count = $params{'count'}||0;
delete($params{'count'});
$limit = $params{'limit'};
delete($params{'limit'});
View
5 Spine/test/101-content-dbi.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::Simple tests=>10;
+use Test::Simple tests=>12;
use DBI;
use SPINE::DBI::Content;
use Data::Dumper;
@@ -14,7 +14,8 @@
"password=s"=>\$psname);
-my $dbh = DBI->connect($dbistr||"dbi:mysql:dbname=test",$username||"spine",$psname||"spine") or die "Could not connect to Database:$!";
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
my $content_dbi = SPINE::DBI::Content->new($dbh);
ok(ref($content_dbi) eq "SPINE::DBI::Content","Return type: Content DBI object");
ok(ref($content_dbi->get({name=>"index.html",count=>1})) eq "ARRAY","Return type: get returns array ref");
View
6 Spine/test/102-message-dbi.pl
@@ -14,7 +14,7 @@
"password=s"=>\$psname);
-my $dbh = DBI->connect($dbistr||"dbi:mysql:dbname=test",$username||"spine",$psname||"spine") or die "Could not connect to Database:$!";
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
my $message_dbi = SPINE::DBI::Messagegroup->new($dbh);
@@ -35,7 +35,7 @@
# Read -- good
-my $mess_content = shift @{$message_dbi->get({'name'=>"news",count=>1})};
+$mess_content = shift @{$message_dbi->get({'name'=>"news",count=>1})};
ok (ref($mess_content) eq 'SPINE::Base::Messagegroup',"This time we have something " . ref($mess_content));
@@ -89,7 +89,7 @@
$message_dbi->remove($mess_cont1);
-my $mess_missing = shift @{$message_dbi->get({'name'=>"attic60",count=>1})};
+$mess_missing = shift @{$message_dbi->get({'name'=>"attic60",count=>1})};
ok ((!$mess_missing),"Remove worked ok.");
View
6 Spine/test/103-adminaccess-dbi.pl
@@ -14,7 +14,7 @@
"password=s"=>\$psname);
-my $dbh = DBI->connect($dbistr||"dbi:mysql:dbname=test",$username||"spine",$psname||"spine") or die "Could not connect to Database:$!";
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
my $message_dbi = SPINE::DBI::Adminaccess->new($dbh);
@@ -35,7 +35,7 @@
# Read -- good
-my $mess_content = shift @{$message_dbi->get({'section'=>"navbar",count=>1})};
+$mess_content = shift @{$message_dbi->get({'section'=>"navbar",count=>1})};
ok (ref($mess_content) eq 'SPINE::Base::Adminaccess',"This time we have something " . ref($mess_content));
@@ -87,7 +87,7 @@
$message_dbi->remove($mess_cont1);
-my $mess_missing = shift @{$message_dbi->get({'usergroup'=>"totallyfake2",count=>1})};
+$mess_missing = shift @{$message_dbi->get({'usergroup'=>"totallyfake2",count=>1})};
ok ((!$mess_missing),"Remove worked ok.");
View
6 Spine/test/105-attribute-dbi.pl
@@ -14,7 +14,7 @@
"password=s"=>\$psname);
-my $dbh = DBI->connect($dbistr||"dbi:mysql:dbname=test",$username||"spine",$psname||"spine") or die "Could not connect to Database:$!";
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
my $message_dbi = SPINE::DBI::Attribute->new($dbh);
@@ -35,7 +35,7 @@
# Read -- good
-my $mess_content = shift @{$message_dbi->get({name=>"counter",section=>'stats',attr=>'_admin.css'})};
+$mess_content = shift @{$message_dbi->get({name=>"counter",section=>'stats',attr=>'_admin.css'})};
ok (ref($mess_content) eq 'SPINE::Base::Attribute',"This time we have something " . ref($mess_content));
@@ -86,7 +86,7 @@
$message_dbi->remove($mess_cont1);
-my $mess_missing = shift @{$message_dbi->get({'attr'=>".foobar/fakie2",count=>1})};
+$mess_missing = shift @{$message_dbi->get({'attr'=>".foobar/fakie2",count=>1})};
ok ((!$mess_missing),"Remove worked ok.");
View
93 Spine/test/106-macro-dbi.pl
@@ -0,0 +1,93 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::Macro;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::Macro->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::Macro","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({name=>"main"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'name'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({name=>"main"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::Macro',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->name() eq 'main', "Got a record from Macro object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::Macro->new({
+ id=>0,
+ name=>'chookie',
+ macrokey=>'huh',
+ macrovalue=>'whatthe'
+ }));
+
+
+# Copy Macro
+
+$mess_content = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+$mess_content->name('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->name() eq 'chookie2', "New element created.");
+
+# Update Macro group
+
+my $mess_cont2 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+$mess_cont2->macrovalue('101');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont3->macrovalue() eq '101', "User setting successfully changed.");
+
+# Delete Macro group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
95 Spine/test/107-messagegroup-dbi.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::Messagegroup;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::Messagegroup->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::Messagegroup","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({name=>"news"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'name'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({name=>"news"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::Messagegroup',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->name() eq 'news', "Got a record from Messagegroup object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::Messagegroup->new({
+ id=>0,
+ name=>'chookie',
+ owner=>'admin',
+ usergroup=>'admin',
+ permissions=>'1111',
+ content=>'blabhlabh'
+ }));
+
+
+# Copy Messagegroup
+
+$mess_content = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+$mess_content->name('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->name() eq 'chookie2', "New element created.");
+
+# Update Messagegroup group
+
+my $mess_cont2 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+$mess_cont2->permissions('1011');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont3->permissions() eq '1011', "User setting successfully changed.");
+
+# Delete Messagegroup group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
102 Spine/test/108-navbar-dbi.pl
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::Navbar;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::Navbar->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::Navbar","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({name=>"news"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'name'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({name=>"main"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::Navbar',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->name() eq 'main', "Got a record from Navbar object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::Navbar->new({
+ id=>0,
+ name=>'chookie',
+ alignment=>'none',
+ positioning=>'horizontal',
+ font=>'',
+ color=>'',
+ size=>'',
+ style=>'normal',
+ sep=>'',
+ modified=>'2011-01-01 04:00:00',
+ owner=>'admin',
+ usergroup=>'users',
+ permissions=>'1010'
+ }));
+
+
+# Copy Navbar
+
+$mess_content = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+$mess_content->name('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->name() eq 'chookie2', "New element created.");
+
+# Update Navbar group
+
+my $mess_cont2 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+$mess_cont2->permissions('1011');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont3->permissions() eq '1011', "User setting successfully changed.");
+
+# Delete Navbar group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
99 Spine/test/109-style-dbi.pl
@@ -0,0 +1,99 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::Style;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::Style->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::Style","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({name=>"news"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'name'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({name=>"main"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::Style',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->name() eq 'main', "Got a record from Style object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::Style->new({
+ id=>0,
+ name=>'chookie',
+ title=>'none',
+ macros=>'',
+ modified=>'2011-01-01 01:01:00',
+ owner=>'admin',
+ usergroup=>'users',
+ permissions=>'1010',
+ body=>'this is fake content',
+ icomment=>'blah, blah, blah'
+ }));
+
+
+# Copy Style
+
+$mess_content = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+$mess_content->name('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->name() eq 'chookie2', "New element created.");
+
+# Update Style group
+
+my $mess_cont2 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+$mess_cont2->permissions('1011');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ($mess_cont3->permissions() eq '1011', "User setting successfully changed.");
+
+# Delete Style group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'name'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'name'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
92 Spine/test/110-usergroup-dbi.pl
@@ -0,0 +1,92 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::Usergroup;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::Usergroup->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::Usergroup","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({username=>"admin"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'username'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({username=>"admin"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::Usergroup',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->username() eq 'admin', "Got a record from Usergroup object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::Usergroup->new({
+ id=>0,
+ username=>'chookie',
+ usergroup=>'users'
+ }));
+
+
+# Copy Usergroup
+
+$mess_content = shift @{$message_dbi->get({'username'=>"chookie",count=>1})};
+
+$mess_content->username('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'username'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->username() eq 'chookie2', "New element created.");
+
+# Update Usergroup group
+
+my $mess_cont2 = shift @{$message_dbi->get({'username'=>"chookie2",count=>1})};
+
+$mess_cont2->usergroup('somethingphony');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'username'=>"chookie2",count=>1})};
+
+ok ($mess_cont3->usergroup() eq 'somethingphony', "User setting successfully changed.");
+
+# Delete Usergroup group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'username'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'username'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
95 Spine/test/111-user-dbi.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::Simple tests=>9;
+use DBI;
+use SPINE::DBI::User;
+use Data::Dumper;
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+my $dbh = DBI->connect($dbistr||$ENV{'dbistr'}||"dbi:mysql:dbname=test",$username||$ENV{'tusername'}||"spine",$psname||$ENV{'tpass'}||"spine") or die "Could not connect to Database:$!";
+
+my $message_dbi = SPINE::DBI::User->new($dbh);
+
+# Check the objects/pre-requisites
+
+ok(ref($message_dbi) eq "SPINE::DBI::User","Return type: Content DBI object");
+
+# Read
+
+ok(ref($message_dbi->get({login=>"admin"})) eq "ARRAY","Return type: get returns array ref");
+
+# Read -- bad
+
+my $mess_content = shift @{$message_dbi->get({'login'=>"somethingnonexistent",count=>1})};
+
+ok ((!$mess_content),"Nothing should be returned with a bad name.");
+
+
+# Read -- good
+
+$mess_content = shift @{$message_dbi->get({login=>"admin"})};
+
+ok (ref($mess_content) eq 'SPINE::Base::User',"This time we have something " . ref($mess_content));
+
+ok ($mess_content->login() eq 'admin', "Got a record from User object");
+
+# Create an adminaccess record
+
+$message_dbi->add(SPINE::Base::User->new({
+ id=>0,
+ login=>'chookie',
+ usergroup=>'users',
+ password=>'blah',
+ fullname=>'John Q. Chookie',
+ email=>'john@chookie.com'
+ }));
+
+
+# Copy User
+
+$mess_content = shift @{$message_dbi->get({'login'=>"chookie",count=>1})};
+
+$mess_content->login('chookie2');
+
+$message_dbi->add($mess_content);
+
+my $mess_cont1 = shift @{$message_dbi->get({'login'=>"chookie2",count=>1})};
+
+ok ($mess_cont1->login() eq 'chookie2', "New element created.");
+
+# Update User group
+
+my $mess_cont2 = shift @{$message_dbi->get({'login'=>"chookie2",count=>1})};
+
+$mess_cont2->login('somethingphony');
+
+$message_dbi->update($mess_cont2);
+
+my $mess_cont3 = shift @{$message_dbi->get({'login'=>"somethingphony",count=>1})};
+
+ok ($mess_cont3->login() eq 'somethingphony', "User setting successfully changed.");
+
+# Delete User group
+
+$message_dbi->remove($mess_content);
+
+my $mess_missing = shift @{$message_dbi->get({'login'=>"chookie",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+$message_dbi->remove($mess_cont1);
+
+$mess_missing = shift @{$message_dbi->get({'login'=>"chookie2",count=>1})};
+
+ok ((!$mess_missing),"Remove worked ok.");
+
+
+1;
View
34 Spine/test/testall.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+use Test::Harness;
+
+use Getopt::Long;
+
+my ($dbistr, $username, $psname);
+
+my $result = GetOptions ("dbistr=s"=>\$dbistr,
+ "username=s"=>\$username,
+ "password=s"=>\$psname);
+
+
+if($dbistr)
+{
+ $ENV{'dbistr'} = $dbistr;
+ $ENV{'tusername'} = $username;
+ $ENV{'tpass'} = $psname;
+}
+
+
+
+my @files = ('107-messagegroup-dbi.pl',
+ '106-macro-dbi.pl' ,
+ '101-content-dbi.pl' ,
+ '102-message-dbi.pl' ,
+ '103-adminaccess-dbi.pl' ,
+ '105-attribute-dbi.pl' ,
+ '108-navbar-dbi.pl' ,
+ '109-style-dbi.pl' ,
+ '110-usergroup-dbi.pl' ,
+ '111-user-dbi.pl'
+ );
+

0 comments on commit 49dbd18

Please sign in to comment.