From 4f27f3ea59baa6cfca0ac1df96b1dfedbd83706c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 2 Jan 2015 14:00:56 +0100 Subject: initial --- t/insert.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 t/insert.t (limited to 't/insert.t') diff --git a/t/insert.t b/t/insert.t new file mode 100644 index 0000000..451e0c4 --- /dev/null +++ b/t/insert.t @@ -0,0 +1,29 @@ +#!/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 = footest.server.lan and host_name = footest.server.lan and address = 127.0.0.1 and _FOO = foo`; +cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing insert'); + +$json = decode_json `./mon --nocolor -m get host where name like footest.server.lan`; +cmp_ok($json->[0]{_FOO}, 'eq', 'foo', 'Testing get after a put'); + +$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.2`; +cmp_ok($json->{message}, 'eq', '1 changes successfully commited', 'Testing insert'); + +$json = decode_json `./mon --nocolor get host where name like footest.server.lan`; +cmp_ok($json->[0]{address}, 'eq', '127.0.0.2', 'Testing get after a put'); + +$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(); + -- cgit v1.2.3