lemonldap-ng/lemonldap-ng-manager/t/15-combination.t

44 lines
1.1 KiB
Perl
Raw Normal View History

# Verify that bas changes are detected
use Test::More;
use strict;
use JSON;
require 't/test-lib.pm';
my $struct = 't/jsonfiles/15-combination.json';
sub body {
return IO::File->new( $struct, 'r' );
}
unlink 't/conf/lmConf-2.json';
2018-12-29 18:50:30 +01:00
mkdir 't/sessions';
my ( $res, $resBody );
ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ),
"Request succeed" );
2022-02-16 17:43:29 +01:00
ok( $res->[0] == 200, "Result code is 200" );
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
2018-12-29 17:16:37 +01:00
ok( $resBody->{result} == 1, "JSON response contains \"result:1\"" )
or print STDERR Dumper($res);
2017-02-15 07:41:50 +01:00
ok( $res = &client->_get( '/confs/2/combModules', 'application/json' ),
'Get combModules' );
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
2017-02-15 07:41:50 +01:00
ok( $res = &client->_get( '/confs/2/ldapServer', 'application/json' ),
'Get combModules' );
2017-02-07 09:05:30 +01:00
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
2017-02-15 07:41:50 +01:00
ok(
$resBody->{value} eq 'ldap://192.168.1.1',
'Key ldapServer has been modified'
);
2017-02-07 09:05:30 +01:00
2017-02-07 09:06:45 +01:00
count(9);
done_testing( count() );
unlink 't/conf/lmConf-2.json';
2018-12-29 17:21:20 +01:00
2019-02-05 23:12:17 +01:00
`rm -rf t/sessions`;