Unit test for #2444

v2.11
Maxime Besson 4 years ago
parent f0a6cf5b4f
commit c289f6b853
  1. 9
      lemonldap-ng-manager/t/06-rest-api-RSA.t

@ -7,12 +7,15 @@ use IO::String;
require 't/test-lib.pm';
sub checkResult {
my $res = shift;
my $res = shift;
my $expecthash = shift;
ok( $res->[0] == 200, "Result code is 200" );
my $key;
ok( $key = from_json( $res->[2]->[0] ), 'Response is JSON' );
like( $key->{private}, qr/BEGIN/, "is PEM formatted" );
like( $key->{public}, qr/BEGIN/, "is PEM formatted" );
ok( $key->{hash}, "hash is non empty" ) if $expecthash;
count(1) if $expecthash;
count(4);
}
@ -24,7 +27,7 @@ ok(
"Request succeed"
);
count(1);
checkResult($res);
checkResult( $res, 1 );
ok(
$res = &client->_post(
@ -34,7 +37,7 @@ ok(
"Request succeed"
);
count(1);
checkResult($res);
checkResult( $res, 1 );
ok(
$res = &client->_post(

Loading…
Cancel
Save