summaryrefslogtreecommitdiff
path: root/t/edit.t
blob: c58bccbcd07fb8c36a87bbb37a7f08333b4ff57d (plain)
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
#!/usr/bin/perl

use strict;
use warnings;
use v5.10;

use JSON;
use Test::More;

chdir '..';
my $json;
my $ret;

$json = decode_json `./mon --nocolor insert host set use = generic-host and  name = footest.server.lan and host_name = footest.server.lan and address = 127.0.0.1`;
cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing insert');

$ret = `EDITOR=/bin/true ./mon --nocolor edit host where name like footest.server.lan`;
cmp_ok($ret, 'eq', '', 'Testing edit');

$ret = `EDITOR=/bin/true ./mon --nocolor edit host where name like footest.server.lan`;
cmp_ok($ret, 'eq', '', 'Testing edit');

$json = decode_json `./mon --nocolor delete host where name like footest.server.lan`;
cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing delete');

done_testing();