Make impersonation tests insensitive to ordering

This commit is contained in:
Maxime Besson 2019-06-13 09:25:59 +02:00
parent 1a66da30f9
commit 0cd12999dd
3 changed files with 40 additions and 50 deletions

View File

@ -114,14 +114,12 @@ ok(
),
'POST checkuser'
);
my @attributes = map /<td class="text-left">(.+)?<\/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 class="text-left">(.+)?<\/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 class="text-left">(.+)?<\/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 class="text-left">(.+)?<\/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

View File

@ -324,25 +324,22 @@ ok( $res->[2]->[0] =~ m%<td class="align-middle">rtyler/dwho</td>%,
or explain( $res->[2]->[0], 'Found rtyler/dwo' );
count(16);
my @attributes = map /<td class="text-left">(.+)?<\/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 class="text-left">(.+)?<\/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();

View File

@ -322,19 +322,16 @@ ok( $res->[2]->[0] =~ m%<td class="align-middle">rtyler/dwho</td>%,
or explain( $res->[2]->[0], 'Found rtyler/dwo' );
count(16);
my @attributes = map /<td class="text-left">(.+)?<\/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 class="text-left">(.+)?<\/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();