[Rt-commit] rt branch, 4.0/sanity-check-url-config, updated. rt-3.9.7-1130-ga6a2c93
Shawn Moore
sartak at bestpractical.com
Tue Dec 28 19:25:35 EST 2010
The branch, 4.0/sanity-check-url-config has been updated
via a6a2c93f569bc742c214cb0824b6111d3b22898b (commit)
from b04468be8ffa4178c7476f1b6c5f8d1414e794f6 (commit)
Summary of changes:
lib/RT/Config.pm | 15 +++++++++++++++
t/api/web-config.t | 22 +++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit a6a2c93f569bc742c214cb0824b6111d3b22898b
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Dec 28 19:25:06 2010 -0500
Validate WebPort
*Probably* not needed but we might as well test it, because it's easy
and we're testing all the others
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index d7ed5c1..d402129 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -583,6 +583,21 @@ our %META = (
}
},
},
+ WebPort => {
+ PostLoadCheck => sub {
+ my $self = shift;
+ my $value = shift;
+
+ if (!$value) {
+ $RT::Logger->error("You must set the WebPort config option");
+ return;
+ }
+
+ if ($value !~ m{^\d+$}) {
+ $RT::Logger->error("The WebPort config option must be an integer");
+ }
+ },
+ },
);
my %OPTIONS = ();
diff --git a/t/api/web-config.t b/t/api/web-config.t
index 316a4a9..390eb94 100644
--- a/t/api/web-config.t
+++ b/t/api/web-config.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test nodb => 1, tests => 24;
+use RT::Test nodb => 1, tests => 34;
sub warnings_from {
my $option = shift;
@@ -66,3 +66,23 @@ like($w[0], qr{The WebDomain config option must not contain a path \(/path\)});
# reinstate a valid WebDomain for other tests
is(warnings_from(WebDomain => 'rt.example.com'), 0);
+# WebPort
+is(warnings_from(WebDomain => 80), 0);
+is(warnings_from(WebDomain => 443), 0);
+is(warnings_from(WebDomain => 8888), 0);
+
+ at w = warnings_from(WebPort => '');
+is(@w, 1);
+like($w[0], qr{You must set the WebPort config option});
+
+ at w = warnings_from(WebPort => 3.14);
+is(@w, 1);
+like($w[0], qr{The WebPort config option must be an integer});
+
+ at w = warnings_from(WebPort => 'wha?');
+is(@w, 1);
+like($w[0], qr{The WebPort config option must be an integer});
+
+# reinstate a valid WebDomain for other tests
+is(warnings_from(WebPort => 443), 0);
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list