Fix some warnings

environments/ppa-mbqj77/deployments/809
Xavier Guimard 6 years ago
parent fcf05c5602
commit 7a5e1df4d2
  1. 2
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Crypto.pm
  2. 20
      lemonldap-ng-manager/t/11-save-changed-conf-with-confirmation.t
  3. 27
      lemonldap-ng-manager/t/12-save-changed-conf.t
  4. 4
      lemonldap-ng-manager/t/71-viewer-with-no-diff.t

@ -79,6 +79,7 @@ sub encrypt {
my ( $self, $data, $low ) = @_;
# pad $data so that its length be multiple of 16 bytes
$data //= '';
my $l = bytes::length($data) % 16;
$data .= "\0" x ( 16 - $l ) unless ( $l == 0 );
@ -93,6 +94,7 @@ sub encrypt {
$iv . $self->_getCipher->set_iv($iv)->encrypt( $hmac . $data ),
'' );
};
if ($@) {
$msg = "Crypt::Rijndael error : $@";
return undef;

@ -76,24 +76,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;

@ -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'
}
];
}

@ -43,7 +43,7 @@ foreach my $i ( 0 .. 1 ) {
count(2);
# Test that Conf key value is sent
my $res = $client2->jsonResponse('/view/2/portalDisplayOidcConsents');
$res = $client2->jsonResponse('/view/2/portalDisplayOidcConsents');
ok( $res->{value} eq '$_oidcConnectedRP', 'Key found' )
or print STDERR Dumper($res);
count(1);
@ -55,7 +55,7 @@ ok( $res->{value} eq '_Hidden_', 'Key is hidden' )
count(1);
# Browse confs is forbidden
my $res = $client2->jsonResponse('/view/2');
$res = $client2->jsonResponse('/view/2');
ok( $res->{value} eq '_Hidden_', 'Key is hidden' )
or print STDERR Dumper($res);
count(1);

Loading…
Cancel
Save