summaryrefslogtreecommitdiff
path: root/t/delete.t
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2015-01-02 14:00:56 +0100
committerPaul Buetow <paul@buetow.org>2015-01-02 14:00:56 +0100
commit4f27f3ea59baa6cfca0ac1df96b1dfedbd83706c (patch)
tree79754e3c49216f80cb3ad5579851fca0bf1a31c9 /t/delete.t
initial
Diffstat (limited to 't/delete.t')
-rw-r--r--t/delete.t28
1 files changed, 28 insertions, 0 deletions
diff --git a/t/delete.t b/t/delete.t
new file mode 100644
index 0000000..7b4a9e6
--- /dev/null
+++ b/t/delete.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use v5.10;
+
+use JSON;
+use Test::More;
+
+chdir '..';
+my $json;
+
+$json = decode_json `./mon --nocolor insert host set use = generic-host and name = footest01.server.lan and host_name = footest01.server.lan and address = 127.0.0.1`;
+cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing insert');
+
+$json = decode_json `./mon --nocolor insert host set use = generic-host and name = footest02.server.lan and host_name = footest02.server.lan and address = 127.0.0.1`;
+cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing insert');
+
+$json = decode_json `./mon --nocolor delete host where name like 'footest01.server.lan'`;
+cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing delete');
+
+$json = decode_json `./mon --nocolor delete host where name like 'footest02.server.lan'`;
+cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing delete');
+
+$json = decode_json `./mon --nocolor get host where name matches 'footest..\\.server\\.lan'`;
+cmp_ok(scalar @$json, 'eq', 0, 'Testing get after delete');
+
+done_testing();