[icinga-checkins] icinga.org: icinga-core/hbaecker/perl-tests: Added subtests to extinfo tests

git at icinga.org git at icinga.org
Sat Jan 23 22:19:10 CET 2010


Module: icinga-core
Branch: hbaecker/perl-tests
Commit: d5b60fe8d63364dd0ed5aea53b5f5012f7f07afa
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=d5b60fe8d63364dd0ed5aea53b5f5012f7f07afa

Author: Hendrik Baecker <andurin at process-zero.de>
Date:   Sat Jan 23 22:18:22 2010 +0100

Added subtests to extinfo tests

---

 t/622extinfo-local.t |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/t/622extinfo-local.t b/t/622extinfo-local.t
index 77e1a4f..ab4e3c7 100644
--- a/t/622extinfo-local.t
+++ b/t/622extinfo-local.t
@@ -13,14 +13,36 @@ my $topdir = "$Bin/..";
 my $cgi_dir = "$topdir/cgi";
 my $extinfo_cgi = "$cgi_dir/extinfo.cgi";
 
+my $number_of_test_run=0;
+my $type="";
+my $query="";
 my $output;
 my $remote_user = "REMOTE_USER=icingaadmin";
 
-plan tests => 2;
-
-$output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET $remote_user QUERY_STRING='nodaemoncheck' $extinfo_cgi`;
-like( $output, "/Process Information/", "extinfo.cgi without params show the process information" );
-
-$output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET $remote_user QUERY_STRING='nodaemoncheck&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" );
-
+$output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET $remote_user QUERY_STRING='nodaemoncheck&type=$type' $extinfo_cgi`;
+subtest "extinfo.cgi without type" => sub {
+	like( $output, "/Process Information/", "extinfo.cgi without params show the process information" );
+	done_testing(1);
+};
+$number_of_test_run++;
+
+$type="1";
+$query="";
+$output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET $remote_user QUERY_STRING='nodaemoncheck&type=$type' $extinfo_cgi`;
+subtest "extinfo.cgi with $type$query" => sub{
+	like( $output, "/It appears as though you do not have permission to view information for this host.../", "Type 1 without host shows an error" );
+	done_testing(1);
+};
+$number_of_test_run++;
+
+$type="1";
+$query="&host=host1";
+$output = `NAGIOS_CGI_CONFIG=etc/cgi.cfg REQUEST_METHOD=GET $remote_user QUERY_STRING='nodaemoncheck&type=$type$query' $extinfo_cgi`;
+subtest "extinfo.cgi with $type$query" => sub{
+	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" );
+	done_testing(1);
+};
+$number_of_test_run++;
+
+
+done_testing($number_of_test_run);





More information about the icinga-checkins mailing list