15-combination.t 887 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#!/usr/bin/env perl -I pl/lib
#
# Verify that bas changes are detected

use Test::More;
use strict;
use JSON;
use Data::Dumper;
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" );
ok( $resBody->{result} == 1, "JSON response contains \"result:1\"" )
  or print STDERR Dumper($res);

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

count(6);

done_testing( count() );

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