Skip to content

Commit

Permalink
fixup! Eval auth
Browse files Browse the repository at this point in the history
  • Loading branch information
dasJ committed Aug 27, 2024
1 parent 979572b commit ee64e91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib/Hydra/Helper/CatalystUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ sub hasEvalJobsetRole {
}

sub mayEvalJobset {
my ($c, $project) = $_;
my ($c, $project) = @_;
return
$c->user_exists &&
(isAdmin($c) ||
Expand Down
16 changes: 9 additions & 7 deletions t/Hydra/Controller/API/checks.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ sub is_json {
}

my $ctx = test_context();

Catalyst::Test->import('Hydra');

my $db = Hydra::Model::DB->new;
hydra_setup($db);

# Create a user to log in to
my $user = $db->resultset('Users')->create({ username => 'alice', emailaddress => '[email protected]', password => '!' });
my $user = $ctx->db->resultset('Users')->create({ username => 'alice', emailaddress => '[email protected]', password => '!' });
$user->setPassword('foobar');
$user->userroles->update_or_create({ role => 'admin' });

Expand Down Expand Up @@ -128,7 +124,10 @@ subtest "/api/push" => sub {
my $jobsetName = $jobset->name;
is($jobset->forceeval, undef, "The existing jobset is not set to be forced to eval");

my $response = request(POST "/api/push?jobsets=$projectName:$jobsetName&force=1", Cookie => $cookie);
my $response = request(POST "/api/push?jobsets=$projectName:$jobsetName&force=1",
Cookie => $cookie,
Referer => 'http://localhost/',
);
ok($response->is_success, "The API enpdoint for triggering jobsets returns 200.");

my $data = is_json($response);
Expand All @@ -147,7 +146,10 @@ subtest "/api/push" => sub {

print STDERR $repo;

my $response = request(POST "/api/push?repos=$repo&force=1", Cookie => $cookie);
my $response = request(POST "/api/push?repos=$repo&force=1",
Cookie => $cookie,
Referer => 'http://localhost/',
);
ok($response->is_success, "The API enpdoint for triggering jobsets returns 200.");

my $data = is_json($response);
Expand Down

0 comments on commit ee64e91

Please sign in to comment.