<commit_before>use lib '/data/Wing/author.t/lib', '/data/Wing/lib';
use Wing::Perl;
use Test::More;

use Wing::Rest::Wingman;
use Wing::Rest::Session;
use Wing::Rest::NotFound;
use TestHelper;

my $andy = TestHelper::init()->{result};

my $job = TestHelper::call('POST','/api/wingman/jobs', { session_id => $andy->{id}, phase => 'howdy', ttr => 60 })->{result};
ok $job->{id} > 0, 'can create a job';

$job = TestHelper::call('GET','/api/wingman/jobs/'.$job->{id}, { session_id => $andy->{id} })->{result};
ok $job->{id} > 0, 'can peek a specific job';

my $state = $job->{state};
$job = TestHelper::call('GET','/api/wingman/jobs/'.$state, { session_id => $andy->{id} })->{result};
is $job->{state}, $state, 'can fetch a job by state';

my $jobs = TestHelper::call('GET','/api/wingman/tubes/'.$job->{tube}.'/jobs', { session_id => $andy->{id} })->{result};
ok scalar(@{$jobs->{items}}) > 0, 'got the jobs of a tube';

my $tubes = TestHelper::call('GET','/api/wingman/tubes', { session_id => $andy->{id} })->{result};
ok scalar(@{$tubes->{items}}) > 0, 'got the list of tubes';

$job = TestHelper::call('DELETE','/api/wingman/jobs/'.$job->{id}, { session_id => $andy->{id} })->{result};
is $job->{success}, 1, 'can delete a job';


<commit_msg>convert wingman rest tests over to TWC<commit_after>use lib '/data/Wing/author.t/lib', '/data/Wing/lib';
use Wing::Perl;
use Test::More;

use Wing::Rest::Wingman;
use Wing::Rest::Session;
use Wing::Rest::NotFound;
use TestHelper;
use Test::Wing::Client;

my $wing = Test::Wing::Client->new();

my $andy = TestHelper::init($wing)->{result};

my $job = $wing->post('wingman/jobs', { session_id => $andy->{id}, phase => 'howdy', ttr => 60 });
ok $job->{id} > 0, 'can create a job';

$job = $wing->get('wingman/jobs/'.$job->{id}, { session_id => $andy->{id} });
ok $job->{id} > 0, 'can peek a specific job';

my $state = $job->{state};
$job = $wing->get('wingman/jobs/'.$state, { session_id => $andy->{id} });
is $job->{state}, $state, 'can fetch a job by state';

my $jobs = $wing->get('wingman/tubes/'.$job->{tube}.'/jobs', { session_id => $andy->{id} });
ok scalar(@{$jobs->{items}}) > 0, 'got the jobs of a tube';

my $tubes = $wing->get('wingman/tubes', { session_id => $andy->{id} });
ok scalar(@{$tubes->{items}}) > 0, 'got the list of tubes';

$job = $wing->delete('wingman/jobs/'.$job->{id}, { session_id => $andy->{id} });
is $job->{success}, 1, 'can delete a job';



{'fraction_non_alphanumeric': 0.26768721555647496, 'fraction_numerical': 0.005792304509722797, 'mean_word_length': 4.941031941031941, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 74, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '319546', 'n_tokens_mistral': 967, 'n_tokens_neox': 929, 'n_words': 219}