Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / t / legacy / integration / ajax.t
bloba1dec0415bf97c23919cc954ef1ffe34330afbab
1 =head1 NAME
3 t/integration/ajax.t - Integration tests for AJAXy stuff
5 =head1 DESCRIPTION
7 Tests for AJAXy stuff.
9 =head1 AUTHORS
11 Jonathan "Duke" Leto
13 =cut
15 use strict;
16 use warnings;
17 use Test::More;
18 use Test::JSON;
19 use JSON::Any;
20 use lib 't/lib';
21 use SGN::Test::WWW::Mechanize;
23 my $mech = SGN::Test::WWW::Mechanize->new;
25 my @ajax_urls = (
26     "/image/ajax/image_ajax_form.pl?action=view",
27     "/image/ajax/image_ajax_form.pl?action=",
28     "/image/ajax/image_ajax_form.pl",
29     "/image/ajax/image_ajax_form.pl?action=edit",
30     "/image/ajax/image_ajax_form.pl?object_id=0",
33 plan( tests => 2*@ajax_urls );
34 my $j = JSON::Any->new;
35 for my $url (@ajax_urls) {
36     $mech->get_ok($url);
37     is_valid_json($mech->content, "$url is valid JSON");
38     my $out = $j->decode( $mech->content );