Merge branch 'master' into topic/dt_feature_search
[sgn.git] / t / legacy / integration / search.t
blob9f6a11bd38d85d3c566267b6653499ed1aa33ca5
1 =head1 NAME
3 t/integration/search.t - integration tests for generic search URLs
5 =head1 DESCRIPTION
7 Tests for search URLs
9 =head1 SYNOPSIS
12 =head1 AUTHORS
14 Jonathan "Duke" Leto
16 =cut
18 use Modern::Perl;
19 use Test::Most;
21 use lib 't/lib';
22 use SGN::Test::Data qw/ create_test /;
23 use SGN::Test::WWW::Mechanize skip_cgi => 1;
25 my $mech = SGN::Test::WWW::Mechanize->new;
27 $mech->get_ok("/search/organisms");
28 $mech->content_like(qr!Organism/Taxon search!);
30 $mech->get_ok("/search");
31 $mech->content_like(qr/Search/);
33 $mech->get_ok("/search/index.pl");
34 $mech->content_like(qr/A database of in-situ/);
36 my $type_regex = {
37     bacs                         => qr/Genomic clone search/,
38     directory                    => qr/Directory search/,
39     est                          => qr/EST search/,
40     est_library                  => qr/Library search/,
41     experiment                   => qr/Expression search/,
42     family                       => qr/Family search/,
43     images                       => qr/Image search/,
44     library                      => qr/Library search/,
45     loci                         => qr/Gene search/,
46     marker                       => qr/Map locations/,
47     markers                      => qr/Marker options/,
48     phenotype                    => qr/Submit new stock/,
49     phenotype_qtl_trait          => qr/Submit new stock/,
50     platform                     => qr/Expression search/,
51     qtl                          => qr/Search QTLs/,
52     template_experiment_platform => qr/Expression search/,
53     trait                        => qr/Browse trait terms/,
54     unigene                      => qr/Unigene search/,
55     glossary                     => qr/Glossary search/,
58 $mech->get("/search/wombats");
59 is($mech->status,404,'/search/wombats is a 404');
61 $mech->get("/search/direct_search.pl?search=wombats");
62 is($mech->status,404,'/search/direct_search.pl?search=wombats is a 404');
64 for my $type (keys %$type_regex) {
65     $mech->get_ok("/search/$type");
66     my $regex = $type_regex->{$type};
67     $mech->content_like($regex); # or diag $mech->content;
69     # the glossary search was never accessible via direct_search
70     $mech->get_ok("/search/direct_search.pl?search=$type") if ($type ne 'glossary');
73 done_testing;