[Rt-commit] rtir branch, 4.0/whois-default-on-lookup-page, created. 4.0.0-56-g6946c43
Jim Brandt
jbrandt at bestpractical.com
Thu Aug 3 14:49:50 EDT 2017
The branch, 4.0/whois-default-on-lookup-page has been created
at 6946c43c51c854e7665bf21b82d8b8020c8f9ac7 (commit)
- Log -----------------------------------------------------------------
commit e3535426825544ae51f585b6519d37a39eaa2435
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Aug 3 14:39:20 2017 -0400
Test to show error with RunWhoisRequestByDefault true and no ticket object
diff --git a/t/tools/lookup_alt_config.t b/t/tools/lookup_alt_config.t
new file mode 100644
index 0000000..91bbac2
--- /dev/null
+++ b/t/tools/lookup_alt_config.t
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 13, config => q{Set($RunWhoisRequestByDefault, 1);};
+use Test::NoWarnings;
+
+RT::Test->started_ok;
+
+my $agent = default_agent();
+
+diag "Test Lookup page with RunWhoisRequestByDefault set to true";
+{
+ $agent->get_ok("/RTIR/Tools/Lookup.html", "Loaded Lookup page");
+ $agent->content_contains('Look Up Information');
+}
+
+my @warnings = &Test::NoWarnings::warnings;
+is( scalar @warnings, 1, 'Caught one startup warning');
+like( $warnings[0]->getMessage, qr/Change of config option \'RunWhoisRequestByDefault\'/,
+ 'Warning about change of config option');
+
+&Test::NoWarnings::clear_warnings;
+ at warnings = &Test::NoWarnings::warnings;
+is( scalar @warnings, 0, 'Config warning cleared');
+
+# done_testing doesn't work here because we are manually checking for warnings
commit 6946c43c51c854e7665bf21b82d8b8020c8f9ac7
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Aug 3 14:45:46 2017 -0400
Confirm TicketObj is defined before checking for queue whois server
The lookup page can be accessed directly from the Tools > Lookup menu,
in which case it won't have a TicketObj. This caused an error when
RunWhoisRequestByDefault was enabled. Check for a TicketObj before
looking for a possible queue-level whois configuration.
diff --git a/html/RTIR/Tools/Elements/ToolResultsWhois b/html/RTIR/Tools/Elements/ToolResultsWhois
index 2e7dc96..3660cc5 100644
--- a/html/RTIR/Tools/Elements/ToolResultsWhois
+++ b/html/RTIR/Tools/Elements/ToolResultsWhois
@@ -137,7 +137,12 @@ $server => undef
$WhoisServer = $server unless defined $WhoisServer;
unless ($WhoisServer) {
return unless RT->Config->Get('RunWhoisRequestByDefault');
- $WhoisServer = $TicketObj->QueueObj->FirstCustomFieldValue('RTIR default WHOIS server') || RT::IR->FirstWhoisServer;
+
+ $WhoisServer = RT::IR->FirstWhoisServer;
+
+ if ( $TicketObj and $TicketObj->QueueObj->FirstCustomFieldValue('RTIR default WHOIS server') ){
+ $WhoisServer = $TicketObj->QueueObj->FirstCustomFieldValue('RTIR default WHOIS server');
+ }
}
return unless $q;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list