summaryrefslogtreecommitdiffstats
path: root/t/012throwables.t
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-10-05 05:20:59 +0200
committermkanat%bugzilla.org <>2006-10-05 05:20:59 +0200
commitd5d46fd5894b7339532c4f7576c8aa55ce44d285 (patch)
tree34cfaa94ec279694af26e426e965996895000865 /t/012throwables.t
parent8d5dd5786873437f9fa840679cd94172e8ca30f1 (diff)
downloadbugzilla-d5d46fd5894b7339532c4f7576c8aa55ce44d285.tar.gz
bugzilla-d5d46fd5894b7339532c4f7576c8aa55ce44d285.tar.xz
Bug 351175: The WebService interface should include the error text along with the error name
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=Wurblzap, a=myk
Diffstat (limited to 't/012throwables.t')
-rw-r--r--t/012throwables.t23
1 files changed, 21 insertions, 2 deletions
diff --git a/t/012throwables.t b/t/012throwables.t
index 8bc749686..b846ab907 100644
--- a/t/012throwables.t
+++ b/t/012throwables.t
@@ -19,6 +19,7 @@
# Rights Reserved.
#
# Contributor(s): Dennis Melentyev <dennis.melentyev@infopulse.com.ua>
+# Max Kanat-Alexander <mkanat@bugzilla.org>
@@ -30,6 +31,8 @@ use strict;
use lib 't';
+use Bugzilla::WebService::Constants;
+
use File::Spec;
use Support::Files;
use Support::Templates;
@@ -63,8 +66,8 @@ foreach my $include_path (@include_paths) {
}
}
-# Count the tests
-my $tests = (scalar keys %test_modules) + (scalar keys %test_templates);
+# Count the tests. The +1 is for checking the WS_ERROR_CODE errors.
+my $tests = (scalar keys %test_modules) + (scalar keys %test_templates) + 1;
exit 0 if !$tests;
# Set requested tests counter.
@@ -162,11 +165,27 @@ foreach my $errtype (keys %Errors) {
}
}
+# And make sure that everything defined in WS_ERROR_CODE
+# is actually a valid error.
+foreach my $err_name (keys %{WS_ERROR_CODE()}) {
+ if (!defined $Errors{'code'}{$err_name}
+ && !defined $Errors{'user'}{$err_name})
+ {
+ Register(\%test_modules, 'WS_ERROR_CODE',
+ "Error tag '$err_name' is used in WS_ERROR_CODE in"
+ . " Bugzilla/WebService/Constants.pm"
+ . " but not defined in any template, and not used in any code.");
+ }
+}
+
# Now report modules results
foreach my $file (sort keys %test_modules) {
Report($file, @{$test_modules{$file}});
}
+# And report WS_ERROR_CODE results
+Report('WS_ERROR_CODE', @{$test_modules{'WS_ERROR_CODE'}});
+
# Now report templates results
foreach my $file (sort keys %test_templates) {
Report($file, @{$test_templates{$file}});