[Rt-commit] rt branch, ip-customfields, updated. rt-3.8.8-866-g8f498d5
? sunnavy
sunnavy at bestpractical.com
Wed Sep 22 00:42:07 EDT 2010
The branch, ip-customfields has been updated
via 8f498d5fb7ccdc502ff59f7f10de9e1c18984b72 (commit)
via b1f9257260f6c4eddedc6487d4bb20b17117126c (commit)
via 8925fbf095d3d4aacbf38dd77ffe68204a1166f7 (commit)
via d1864289647298ffbaf48233d05cb795961a7db7 (commit)
from 46aa1f2342f46e78123fa74bb046bacb16dabfa4 (commit)
Summary of changes:
...{SelectCustomFieldOperator => SelectIPRelation} | 4 +-
share/html/Search/Elements/PickCFs | 7 +++++
t/customfields/ip.t | 16 +++++++++--
t/customfields/iprange.t | 12 ++++++++-
t/customfields/ipv6.t | 27 +++++++++++++++++++-
5 files changed, 59 insertions(+), 7 deletions(-)
copy share/html/Elements/{SelectCustomFieldOperator => SelectIPRelation} (93%)
mode change 100755 => 100644
- Log -----------------------------------------------------------------
commit d1864289647298ffbaf48233d05cb795961a7db7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Sep 22 12:10:46 2010 +0800
limit IPAddress operators
diff --git a/share/html/Elements/SelectIPRelation b/share/html/Elements/SelectIPRelation
new file mode 100644
index 0000000..37d901b
--- /dev/null
+++ b/share/html/Elements/SelectIPRelation
@@ -0,0 +1,64 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<select name="<% $Name %>">
+% while (my $option = shift @Options) {
+% my $value = shift @Values;
+<option value="<% $value %>"
+% if ($Default eq $value) {
+selected="selected"
+% }
+><% $option %></option>
+% }
+</select>
+
+<%ARGS>
+$Name => undef
+ at Options => ( loc('is'), loc("isn't"), loc('less than'), loc('greater than'))
+ at Values => ('=', '!=', '<', '>')
+$Default => ''
+</%ARGS>
diff --git a/share/html/Search/Elements/PickCFs b/share/html/Search/Elements/PickCFs
index a744500..5c66c55 100644
--- a/share/html/Search/Elements/PickCFs
+++ b/share/html/Search/Elements/PickCFs
@@ -86,6 +86,13 @@ while ( my $CustomField = $CustomFields->Next ) {
Path => '/Elements/SelectDateRelation',
Arguments => {},
};
+ }
+ elsif ($CustomField->Type =~ /^IPAddress(Range)?$/ ) {
+ $line{'Op'} = {
+ Type => 'component',
+ Path => '/Elements/SelectIPRelation',
+ Arguments => {},
+ };
} else {
$line{'Op'} = {
Type => 'component',
commit 8925fbf095d3d4aacbf38dd77ffe68204a1166f7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Sep 22 12:39:50 2010 +0800
skip instead of todo
diff --git a/t/customfields/ip.t b/t/customfields/ip.t
index 9f38086..5ff5504 100644
--- a/t/customfields/ip.t
+++ b/t/customfields/ip.t
@@ -267,8 +267,8 @@ diag "create a ticket with an IP of 10.0.0.1 and search for doesn't match '10.0.
my $tickets = RT::Tickets->new($RT::SystemUser);
$tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
- TODO: {
- local $TODO = "the ticket is matched because we fail to parse '10.0.0.' as an IP address so it's not canonicalized to '010.000.000.' which is what we would need to do for LIKE";
+ SKIP: {
+ skip "partical ip parse causes ambiguity", 1;
is( $tickets->Count, 0, "should not have found the ticket" );
}
}
commit b1f9257260f6c4eddedc6487d4bb20b17117126c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Sep 22 12:40:34 2010 +0800
failure LIKE test for ipv6
diff --git a/t/customfields/ipv6.t b/t/customfields/ipv6.t
index f41c104..765d84f 100644
--- a/t/customfields/ipv6.t
+++ b/t/customfields/ipv6.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 186;
+use RT::Test tests => 189;
my ( $baseurl, $agent ) = RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -247,3 +247,28 @@ diag "create two tickets with different IPs and check several searches"
'bbcd' . ':0000' x 7, "correct value" );
}
+diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd:23'."
+ if $ENV{'TEST_VERBOSE'};
+{
+ ok $agent->goto_create_ticket($q), "go to create ticket";
+ my $cf_field = "Object-RT::Ticket--CustomField-$cf_id-Values";
+ $agent->submit_form(
+ form_name => 'TicketCreate',
+ fields => {
+ Subject => 'local',
+ $cf_field => 'abcd:23::',
+ }
+ );
+
+ my ($id) = $agent->content =~ /Ticket (\d+) created/;
+ ok( $id, "created first ticket $id" );
+
+ my $tickets = RT::Tickets->new($RT::SystemUser);
+ $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
+
+ SKIP: {
+ skip "partical ip parse can causes ambiguity", 1;
+ is( $tickets->Count, 0, "should not have found the ticket" );
+ }
+}
+
commit 8f498d5fb7ccdc502ff59f7f10de9e1c18984b72
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Sep 22 12:41:08 2010 +0800
ip operator tests
diff --git a/t/customfields/ip.t b/t/customfields/ip.t
index 5ff5504..0078082 100644
--- a/t/customfields/ip.t
+++ b/t/customfields/ip.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 67;
+use RT::Test tests => 71;
my ( $baseurl, $agent ) = RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -273,3 +273,13 @@ diag "create a ticket with an IP of 10.0.0.1 and search for doesn't match '10.0.
}
}
+
+diag "test the operators in search page" if $ENV{'TEST_VERBOSE'};
+{
+ $agent->get_ok( $baseurl . "/Search/Build.html?Query=Queue='General'" );
+ $agent->content_contains('CF.{IP}', 'got CF.{IP}');
+ my $form = $agent->form_number(3);
+ my $op = $form->find_input("'CF.{IP}'Op");
+ ok( $op, "found 'CF.{IP}'Op" );
+ is_deeply( [ $op->possible_values ], [ '=', '!=', '<', '>' ], 'op values' );
+}
diff --git a/t/customfields/iprange.t b/t/customfields/iprange.t
index 73ff6e2..81493fc 100644
--- a/t/customfields/iprange.t
+++ b/t/customfields/iprange.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 127;
+use RT::Test tests => 131;
my ($baseurl, $agent) =RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -457,3 +457,13 @@ diag "create two tickets with different IP ranges and check several searches" if
}
+diag "test the operators in search page" if $ENV{'TEST_VERBOSE'};
+{
+ $agent->get_ok( $baseurl . "/Search/Build.html?Query=Queue='General'" );
+ $agent->content_contains('CF.{IP}', 'got CF.{IP}');
+ my $form = $agent->form_number(3);
+ my $op = $form->find_input("'CF.{IP}'Op");
+ ok( $op, "found 'CF.{IP}'Op" );
+ is_deeply( [ $op->possible_values ], [ '=', '!=', '<', '>' ], 'op values' );
+}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list