bandaided sigpep finder to not fail with missing temp dir
[sgn.git] / t / controller_Clone_Genomic.t
blob287ed6c8e723307d261495a951fa2ad8852e1595
1 use Data::Dumper;
2 use File::Temp;
4 use Test::More tests => 2;
6 use Path::Class;
8 use CXGN::Genomic::Clone;
9 use CXGN::PotatoGenome::FileRepository;
10 use CXGN::Publish;
12 use_ok('SGN::Controller::Clone::Genomic');
14 my $tempdir  = File::Temp->newdir;
15 my $tempfile = File::Temp->new;
16 file($tempfile->filename)->openw->print(">RH123D21\nACTGACTGACTAGATGATCATCGATCGAGAGCG\n");
18 my $repos = CXGN::PotatoGenome::FileRepository->new( "$tempdir" );
20 my $ctl = SGN::Controller::Clone::Genomic->new;
21 my $clone = CXGN::Genomic::Clone->retrieve_from_clone_name( 'RH123D21' );
23 SKIP: {
24     my $test_vf;
25     eval {
26         $test_vf = $repos->get_vf( class => 'SingleCloneSequence',
27                         sequence_name => $clone->latest_sequence_name,
28                         format => 'fasta',
29                         project => $clone->seqprops->{project_country} );
30     };
31     skip 'could not retrieve clone, cannot test _potato_seq_files', 1 unless $test_vf;
33     $repos->publish( $test_vf->publish_new_version( $tempfile->filename ) );
35     skip 'could not retrieve clone, cannot test _potato_seq_files', 1 unless $clone;
37     my %files = $ctl->_potato_seq_files( undef, $clone, $tempdir );
38     ok( -f $files{seq}, 'got a potato seq file' )
39     or diag Dumper { files =>  \%files, find => scalar(`find $tempdir`) };