Debian Codegraph @

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

raw
1 # Verify that bas changes are detected
2
3 use warnings;
4 use Test::More;
5 use strict;
6 use JSON;
7 require 't/test-lib.pm';
8
9 my $struct = 't/jsonfiles/15-combination.json';
10
11 my ( $len, $body ) = substitute_io_handle($struct);
12
13 my ( $res, $resBody );
14 ok(
15 $res =
16 &client->_post( '/confs/', 'cfgNum=1', $body, 'application/json', $len ),
17 "Request succeed"
18 );
19 ok( $res->[0] == 200, "Result code is 200" );
20 ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
21 ok( $resBody->{result} == 1, "JSON response contains \"result:1\"" )
22 or print STDERR Dumper($res);
23
24 ok( $res = &client->_get( '/confs/2/combModules', 'application/json' ),
25 'Get combModules' );
26 ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
27
28 ok( $res = &client->_get( '/confs/2/ldapServer', 'application/json' ),
29 'Get combModules' );
30 ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
31 ok(
32 $resBody->{value} eq 'ldap://192.168.1.1',
33 'Key ldapServer has been modified'
34 );
35
36 count(9);
37
38 done_testing( count() );