forked from lix-project/hydra
t/Controller/Build/constituents.t: assert the response is valid JSON, dump if it isn't
This commit is contained in:
parent
12ff981d24
commit
23d7046522
|
@ -36,7 +36,14 @@ my $constituents = request(GET $url,
|
||||||
);
|
);
|
||||||
|
|
||||||
ok($constituents->is_success, "Getting the constituent builds");
|
ok($constituents->is_success, "Getting the constituent builds");
|
||||||
my $data = decode_json($constituents->content);
|
|
||||||
|
my $data;
|
||||||
|
my $valid_json = lives { $data = decode_json($constituents->content); };
|
||||||
|
ok($valid_json, "We get back valid JSON.");
|
||||||
|
if (!$valid_json) {
|
||||||
|
use Data::Dumper;
|
||||||
|
print STDERR Dumper $constituents->content;
|
||||||
|
}
|
||||||
|
|
||||||
my ($buildA) = grep { $_->{nixname} eq "empty-dir-a" } @$data;
|
my ($buildA) = grep { $_->{nixname} eq "empty-dir-a" } @$data;
|
||||||
my ($buildB) = grep { $_->{nixname} eq "empty-dir-b" } @$data;
|
my ($buildB) = grep { $_->{nixname} eq "empty-dir-b" } @$data;
|
||||||
|
|
Loading…
Reference in a new issue