15-combination.t 1.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# 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';

my ( $res, $resBody );
ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ),
    "Request succeed" );
ok( $res->[0] == 200, "Result code is 200" );
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
21
ok( $resBody->{result} == 0, "JSON response contains \"result:0\"" )
22 23
  or print STDERR Dumper($res);

24 25
ok( $res = &client->_get( '/confs/2/combModules', 'application/json' ),
    'Get combModules' );
26 27
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );

28 29
ok( $res = &client->_get( '/confs/2/ldapServer', 'application/json' ),
    'Get combModules' );
30
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
31 32 33 34
ok(
    $resBody->{value} eq 'ldap://192.168.1.1',
    'Key ldapServer has been modified'
);
35

Xavier Guimard's avatar
Xavier Guimard committed
36
count(9);
37 38 39 40

done_testing( count() );

unlink 't/conf/lmConf-2.json';