Fix tests

This commit is contained in:
Eelco Dolstra 2012-03-13 13:18:40 +01:00
parent 1f268d2d43
commit fa62c8b7f2
3 changed files with 9 additions and 9 deletions

View file

@ -3,6 +3,7 @@ package Setup;
use strict;
use Exporter;
use Hydra::Helper::Nix;
use Hydra::Model::DB;
use Hydra::Helper::AddBuilds;
use Cwd;
@ -32,7 +33,8 @@ sub nrQueuedBuildsForJobset {
sub createBaseJobset {
my ($jobsetName, $nixexprpath) = @_;
my $project = openHydraDB->resultset('Projects')->update_or_create({name => "tests", displayname => "", owner => "root"});
my $db = Hydra::Model::DB->new;
my $project = $db->resultset('Projects')->update_or_create({name => "tests", displayname => "", owner => "root"});
my $jobset = $project->jobsets->create({name => $jobsetName, nixexprinput => "jobs", nixexprpath => $nixexprpath, emailoverride => ""});
my $jobsetinput;

View file

@ -1,12 +1,11 @@
use strict;
use Hydra::Schema;
use Hydra::Helper::Nix;
use Hydra::Model::DB;
use Hydra::Helper::AddBuilds;
use Cwd;
use Setup;
my $db = openHydraDB;
my $db = Hydra::Model::DB->new;
use Test::Simple tests => 28;

View file

@ -1,10 +1,10 @@
use strict;
use Hydra::Schema;
use Hydra::Helper::Nix;
use Hydra::Model::DB;
my $db = openHydraDB;
my $db = Hydra::Model::DB->new;
my @sources = $db->sources;
my @sources = $db->schema->sources;
my $nrtables = scalar(@sources);
use Test::Simple tests => 42;
@ -15,8 +15,7 @@ foreach my $source (@sources) {
ok(scalar($db->resultset($source)->all) == 1, $title);
} elsif( $source !~ m/^(LatestSucceeded|JobStatus|ActiveJobs)/) {
ok(scalar($db->resultset($source)->all) == 0, $title);
}
else {
} else {
ok(scalar($db->resultset($source)->search({},{ bind => ["", "", ""] })) == 0, $title);
}
}