3 use Test::More tests => 7;
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 $mech->with_test_level( local => sub {
21 # TODO: these tests depend on live data.
37 $mech->get_ok('/bulk/feature');
38 $mech->submit_form_ok({
39 form_name => "bulk_feature",
43 }, "submit bulk_feature form");
44 $mech->content_like(qr/Download as/);
46 my $sha1 = sha1_hex($ids);
47 my @links = $mech->find_all_links( url_regex => qr{/bulk/feature/download/$sha1\.fasta} );
49 cmp_ok(@links, '==', 1, "found one FASTA download link for $sha1.fasta");
51 @links = grep { $_ =~ qr{$sha1} } $mech->find_all_links(url_regex => qr{/bulk/feature/download/.*\.fasta} );
53 cmp_ok(@links, '==', 0, "found no other download links") or diag("Unexpected download links" . Dumper [ map {$_->url} @links ]);
58 $mech->with_test_level( local => sub {
59 # attempt to post an empty list
60 $mech->post('/bulk/feature/submit/', { ids => "" } );
61 is($mech->status,400);