|
|
|
@ -20,7 +20,7 @@ mkdir 't/sessions'; |
|
|
|
|
my ( $res, $resBody ); |
|
|
|
|
ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ), |
|
|
|
|
"Request succeed" ); |
|
|
|
|
ok( $res->[0] == 200, "Result code is 200" ); |
|
|
|
|
ok( $res->[0] == 200, "Result code is 200" ); |
|
|
|
|
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" ); |
|
|
|
|
ok( $resBody->{result} == 1, "JSON response contains \"result:1\"" ) |
|
|
|
|
or print STDERR Dumper($resBody); |
|
|
|
@ -54,24 +54,24 @@ while ( my $c = shift @{ $resBody->{details}->{__changes__} } ) { |
|
|
|
|
my $cmp1 = @changes; |
|
|
|
|
my $cmp2 = @cmsg; |
|
|
|
|
|
|
|
|
|
my @d1 = grep { $_->{key} eq $c->{key} } @changes; |
|
|
|
|
my @d2 = grep { $_->{key} eq $c->{key} } @cmsg; |
|
|
|
|
@changes = grep { $_->{key} ne $c->{key} } @changes; |
|
|
|
|
@cmsg = grep { $_->{key} ne $c->{key} } @cmsg; |
|
|
|
|
if ( $c->{key} eq 'applicationList' ) { |
|
|
|
|
@changes = grep { ( $_->{key} || '' ) ne ( $c->{key} || '' ) } @changes; |
|
|
|
|
@cmsg = grep { ( $_->{key} || '' ) ne ( $c->{key} || '' ) } @cmsg; |
|
|
|
|
if ( $c->{key} and $c->{key} eq 'applicationList' ) { |
|
|
|
|
pass qq("$c->{key}" found); |
|
|
|
|
count(1); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
elsif ( $c->{key} ) { |
|
|
|
|
ok( ( $cmp1 - @changes ) == ( $cmp2 - @cmsg ), qq("$c->{key}" found) ) |
|
|
|
|
or print STDERR 'Expect: ' |
|
|
|
|
. ( $cmp1 - @changes ) |
|
|
|
|
. ', got: ' |
|
|
|
|
. ( $cmp2 - @cmsg ) |
|
|
|
|
. "\nExpect: " |
|
|
|
|
. Dumper( \@d1 ) . "Got: " |
|
|
|
|
. Dumper( \@d2 ); |
|
|
|
|
. "\nChanges " |
|
|
|
|
. Dumper( \@changes ) |
|
|
|
|
. "Cmsg: " |
|
|
|
|
. Dumper( \@cmsg ); |
|
|
|
|
count(1); |
|
|
|
|
} |
|
|
|
|
count(1); |
|
|
|
|
} |
|
|
|
|
ok( !@changes, 'All changes detected' ) or $bug = 1; |
|
|
|
|
|
|
|
|
@ -107,7 +107,8 @@ done_testing( count() ); |
|
|
|
|
`rm -rf t/sessions`; |
|
|
|
|
|
|
|
|
|
sub changes { |
|
|
|
|
return [ { |
|
|
|
|
return [ |
|
|
|
|
{ |
|
|
|
|
'key' => 'portal', |
|
|
|
|
'new' => 'http://auth2.example.com/', |
|
|
|
|
'old' => 'http://auth.example.com/' |
|
|
|
@ -227,7 +228,7 @@ sub changes { |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
'confCompacted' => '1', |
|
|
|
|
'removedKeys' => 'some; keys' |
|
|
|
|
'removedKeys' => 'some; keys' |
|
|
|
|
} |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|