lib/Test2/Harness/UI/Controller/Job.pm untested

filter: Statementstmt 0.0% 0 / 46 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 71 CC 2 SCAR 9.8
CC
2
Cov
0%
handle
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.7
1 package Test2::Harness::UI::Controller::Job;
2 use strict;
3 use warnings;
4  
5 our $VERSION = '0.000150';
6  
7 use Data::GUID;
8 use List::Util qw/max/;
9 use Text::Xslate(qw/mark_raw/);
10 use Test2::Harness::UI::Util qw/share_dir find_job/;
11 use Test2::Harness::UI::Response qw/resp error/;
12 use Test2::Harness::Util::JSON qw/encode_json decode_json/;
13  
14 use parent 'Test2::Harness::UI::Controller';
15 use Test2::Harness::UI::Util::HashBase qw/-title/;
16  
17 sub handle {
18 my $self = shift;
19 my ($route) = @_;
20  
21 my $req = $self->{+REQUEST};
22  
23 my $res = resp(200);
24  
25 my $schema = $self->{+CONFIG}->schema;
26 my $user = $req->user;
27  
28 die error(404 => 'Missing route') unless $route;
29 my $it = $route->{job} or die error(404 => 'No job uuid');
30 my $try = $route->{try};
31  
32 my $job = find_job($schema, $it, $try) // die error(404 => 'Invalid Job');
33  
34 $self->{+TITLE} = 'Job: ' . ($job->file || $job->name) . ' - ' . $job->job_id . '+' . $job->job_try;
35  
36 $res->content_type('application/json');
37 $res->raw_body($job);
38 return $res;
39 }
40  
41 1;
42  
43 __END__