-
Notifications
You must be signed in to change notification settings - Fork 9
/
53-headings_byhash.t
37 lines (27 loc) · 1.16 KB
/
53-headings_byhash.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
use strict;
use warnings;
use lib qw( t/lib );
use JSON::XS;
use Test::More 'no_plan';
# test should allow override of display_name but not change
# the displayed columns
# application loads
BEGIN {
$ENV{AUTOCRUD_DEBUG} = 1;
$ENV{AUTOCRUD_CONFIG} = 't/lib/headings_byhash.conf';
use_ok "Test::WWW::Mechanize::Catalyst::AJAX" => "TestAppCustomConfig";
}
my $mech = Test::WWW::Mechanize::Catalyst::AJAX->new;
$mech->get_ok("/autocrud/site/default/schema/dbic/source/album/dumpmeta", "Get metadata for album table");
my $content = JSON::XS::decode_json($mech->content);
ok(exists $content->{cpac}->{conf}->{dbic}->{t}->{album}->{headings}, 'headings created');
my $headings = $content->{cpac}->{conf}->{dbic}->{t}->{album}->{headings};
ok(ref $headings eq 'HASH', 'headings imported as hash');
#use Data::Dumper;
#print STDERR Dumper $headings;
ok(scalar keys %$headings, 'only two columns selected');
ok($headings->{title} eq 'TheTitle', 'heading value for Title preserved');
ok($headings->{recorded} eq 'Recorded', 'heading value for Recorded preserved');
ok($headings->{copyright} eq 'Copyrights', 'heading value for Copyright preserved');
__END__