[icinga-checkins] icinga.org: icinga-core/dev/cgis: Rewrite and enhance 622extinfo-local.t

git at icinga.org git at icinga.org
Sat Feb 25 15:43:47 CET 2012


Module: icinga-core
Branch: dev/cgis
Commit: 4b4018c365f828736c618f4758e7fc360808fcdb
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=4b4018c365f828736c618f4758e7fc360808fcdb

Author: Alexander Wirt <formorer at debian.org>
Date:   Sat Feb 25 09:31:55 2012 +0100

Rewrite and enhance 622extinfo-local.t

---

 t/622extinfo-local.t |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/t/622extinfo-local.t b/t/622extinfo-local.t
new file mode 100644
index 0000000..e6da7bf
--- /dev/null
+++ b/t/622extinfo-local.t
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+#
+# Local Checks for extinfo.cgi
+
+use warnings;
+use strict;
+use Test::Most;
+use Icinga::Test qw ( run_cgi get_body );
+
+my $tests = 2;
+
+my $output = run_cgi('etc/cgi.cfg', 'GET', '', 'extinfo.cgi');
+like( $output, "/Process Information/", "extinfo.cgi without params show the process information" );
+
+$output = run_cgi('etc/cgi.cfg', 'GET', 'type=1&host=host1', 'extinfo.cgi');
+like( $output, "/Schedule downtime for this host and all services/", "extinfo.cgi allows us to set downtime for a host and all of his services" );
+
+# test the json exporter
+SKIP: {
+    eval { require Test::JSON };
+    skip "Test::JSON not installed", 2 if $@;
+
+    use Test::JSON;
+    $tests += 2;
+    $output = run_cgi('etc/cgi.cfg', 'GET', 'jsonoutput', 'extinfo.cgi');
+
+    is_valid_json(get_body($output), 'json output should be well formed');
+
+    use JSON;
+    my $data = decode_json(get_body($output));
+    cmp_deeply($data->{extinfo}->{process_info}, superhashof({
+                'icinga_pid' => 48451,
+                'program_start_time' => '05-15-2009 00:56:31',
+      }), 'Check some contents of json output');
+}
+
+done_testing($tests);





More information about the icinga-checkins mailing list