3 use Test::More tests => 6;
6 use SGN::Test::Data qw/ create_test /;
7 use Catalyst::Test 'SGN';
8 use Digest::SHA1 qw/sha1_hex/;
11 use_ok 'SGN::Controller::Bulk';
12 use aliased 'SGN::Test::WWW::Mechanize' => 'Mech';
16 my $poly_cvterm = create_test('Cv::Cvterm', { name => 'polypeptide' });
17 my $poly_feature = create_test('Sequence::Feature', { type => $poly_cvterm });
19 # TODO: these tests depend on live data.
35 $mech->with_test_level( local => sub {
36 $mech->get_ok('/bulk/feature');
37 $mech->submit_form_ok({
38 form_name => "bulk_feature",
42 }, "submit bulk_feature form");
43 my $sha1 = sha1_hex($ids);
44 my @links = $mech->find_all_links( url_regex => qr{/bulk/feature/download/$sha1\.fasta} );
46 cmp_ok(@links, '==', 1, "found one FASTA download link for $sha1.fasta");
48 @links = $mech->find_all_links( url_regex => qr{/bulk/feature/download/.*\.fasta} );
50 cmp_ok(@links, '==', 0, "found no other download links") or diag("Unexpected download links" . Dumper [ map {$_->url} @links ]);
55 $mech->with_test_level( local => sub {
56 # attempt to post an empty list
57 $mech->post('/bulk/feature/download/', { ids => "" } );
58 is($mech->status,400);