diff --git a/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t b/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t index e74a6beeb..486266d6a 100644 --- a/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t +++ b/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t @@ -114,14 +114,12 @@ ok( ), 'POST checkuser' ); -my @attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar @attributes == 30, 'Found 30 attributes' ) - or print STDERR "Missing attributes -> " . scalar @attributes; -ok( $attributes[12] eq '_updateTime', '_updateTime' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[13] =~ /^\d{14}$/, 'Timestamp found' ) - or print STDERR Dumper( \@attributes ); -count(4); +my %attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; +ok( scalar keys %attributes == 16, 'Found 16 attributes' ) + or print STDERR "Missing attributes -> " . scalar keys %attributes; +ok( $attributes{'_updateTime'} =~ /^\d{14}$/, 'Timestamp found' ) + or print STDERR Dumper( \%attributes ); +count(3); diag 'Waiting'; sleep 3; @@ -184,17 +182,15 @@ ok( ), 'POST checkuser' ); -my @attributes2 = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar @attributes2 == 30, 'Found 30 attributes' ) - or print STDERR "Missing attributes -> " . scalar @attributes2; -ok( $attributes2[12] eq '_updateTime', '_updateTime' ) - or print STDERR Dumper( \@attributes2 ); -ok( $attributes2[13] =~ /^\d{14}$/, 'Timestamp found' ) - or print STDERR Dumper( \@attributes2 ); -count(4); +my %attributes2 = map /(.+)?<\/td>/g, $res->[2]->[0]; +ok( scalar keys %attributes2 == 16, 'Found 16 attributes' ) + or print STDERR "Missing attributes -> " . scalar keys %attributes2; +ok( $attributes2{'_updateTime'} =~ /^\d{14}$/, 'Timestamp found' ) + or print STDERR Dumper( \%attributes2 ); +count(3); -ok( $attributes2[13] - $attributes[13] >= 3, '_updateTime has been updated' ) - or print STDERR Dumper( \@attributes2 ); +ok( $attributes2{_updateTime} - $attributes{_updateTime} >= 3, '_updateTime has been updated' ) + or print STDERR Dumper( \%attributes2 ); count(1); # Log out request diff --git a/lemonldap-ng-portal/t/68-Impersonation-with-doubleCookies.t b/lemonldap-ng-portal/t/68-Impersonation-with-doubleCookies.t index 43c468c36..7056cca88 100644 --- a/lemonldap-ng-portal/t/68-Impersonation-with-doubleCookies.t +++ b/lemonldap-ng-portal/t/68-Impersonation-with-doubleCookies.t @@ -324,25 +324,22 @@ ok( $res->[2]->[0] =~ m%rtyler/dwho%, or explain( $res->[2]->[0], 'Found rtyler/dwo' ); count(16); -my @attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar @attributes == 62, 'Found 61 attributes' ) - or print STDERR ( @attributes < 62 ) - ? "Missing attributes -> " . scalar @attributes - : "Too much attributes -> " . scalar @attributes; -ok( $attributes[0] eq '_auth', '_auth' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[1] eq 'Demo', 'Demo' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[2] eq '_httpSession', '_httpSession' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[28] eq 'uid', 'uid' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[30] eq 'testPrefix__auth', 'testPrefix__auth' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[32] eq 'testPrefix__httpSession', 'testPrefix__httpSession' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[60] eq 'testPrefix_uid', 'testPrefix_uid' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[61] eq 'rtyler', 'rtyler' ) - or print STDERR Dumper( \@attributes ); -count(9); +my %attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; +ok( scalar keys %attributes == 33, 'Found 33 attributes' ) + or print STDERR ( keys %attributes < 33 ) + ? "Missing attributes -> " . scalar keys %attributes + : "Too much attributes -> " . scalar keys %attributes; +ok( $attributes{'_auth'} eq 'Demo', '_auth' ) or print STDERR Dumper( \%attributes ); +ok( $attributes{'_httpSession'}, '_httpSession' ) + or print STDERR Dumper( \%attributes ); +ok( $attributes{'uid'}, 'uid' ) or print STDERR Dumper( \%attributes ); +ok( $attributes{'testPrefix__auth'}, 'testPrefix__auth' ) + or print STDERR Dumper( \%attributes ); +ok( $attributes{'testPrefix__httpSession'}, 'testPrefix__httpSession' ) + or print STDERR Dumper( \%attributes ); +ok( $attributes{'testPrefix_uid'} eq 'rtyler', 'testPrefix_uid' ) + or print STDERR Dumper( \%attributes ); +count(7); $client->logout($id); clean_sessions(); diff --git a/lemonldap-ng-portal/t/68-Impersonation.t b/lemonldap-ng-portal/t/68-Impersonation.t index 933359905..0625264a7 100644 --- a/lemonldap-ng-portal/t/68-Impersonation.t +++ b/lemonldap-ng-portal/t/68-Impersonation.t @@ -322,19 +322,16 @@ ok( $res->[2]->[0] =~ m%rtyler/dwho%, or explain( $res->[2]->[0], 'Found rtyler/dwo' ); count(16); -my @attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar @attributes == 58, 'Found 58 attributes' ) - or print STDERR "Missing attributes -> " . scalar @attributes; -ok( $attributes[0] eq '_auth', '_auth' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[1] eq 'Demo', 'Demo' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[26] eq 'uid', 'uid' ) or print STDERR Dumper( \@attributes ); -ok( $attributes[28] eq 'testPrefix__auth', 'testPrefix__auth' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[56] eq 'testPrefix_uid', 'testPrefix_uid' ) - or print STDERR Dumper( \@attributes ); -ok( $attributes[57] eq 'rtyler', 'rtyler' ) - or print STDERR Dumper( \@attributes ); -count(7); +my %attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; +ok( keys %attributes == 31, 'Found 31 attributes' ) + or print STDERR "Missing attributes -> " . scalar %attributes; +ok( $attributes{'_auth'} eq 'Demo', '_auth' ) or print STDERR Dumper( \%attributes ); +ok( $attributes{'uid'}, 'uid' ) or print STDERR Dumper( \%attributes ); +ok( $attributes{'testPrefix__auth'}, 'testPrefix__auth' ) + or print STDERR Dumper( \%attributes ); +ok( $attributes{'testPrefix_uid'} eq 'rtyler', 'testPrefix_uid' ) + or print STDERR Dumper( \%attributes ); +count(5); $client->logout($id); clean_sessions();