[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-4-g7cf3658
? sunnavy
sunnavy at bestpractical.com
Wed Sep 29 02:57:48 EDT 2010
The branch, 3.9-trunk has been updated
via 7cf3658fc5daf5125a9fccbd9807780ceb0674c2 (commit)
from beaebf19c94c527a05f91a3176dbd536b4076135 (commit)
Summary of changes:
t/customfields/ipv6.t | 105 +++++++++++++++++++------------------------------
1 files changed, 41 insertions(+), 64 deletions(-)
- Log -----------------------------------------------------------------
commit 7cf3658fc5daf5125a9fccbd9807780ceb0674c2
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Sep 29 15:00:54 2010 +0800
remove redundant tests
diff --git a/t/customfields/ipv6.t b/t/customfields/ipv6.t
index 765d84f..8ba1a40 100644
--- a/t/customfields/ipv6.t
+++ b/t/customfields/ipv6.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 189;
+use RT::Test tests => 108;
my ( $baseurl, $agent ) = RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -75,6 +75,10 @@ diag "create a ticket via web and set IP" if $ENV{'TEST_VERBOSE'};
ok( $ticket->id, 'loaded ticket' );
is( $ticket->FirstCustomFieldValue('IP'), $valid{$ip},
'correct value' );
+
+ my $tickets = RT::Tickets->new($RT::SystemUser);
+ $tickets->FromSQL("id = $id AND CF.{IP} = '$ip'");
+ ok( $tickets->Count, "found tickets" );
}
}
@@ -82,52 +86,51 @@ diag "create a ticket and edit IP field using Edit page"
if $ENV{'TEST_VERBOSE'};
{
- for my $ip ( keys %valid ) {
- ok $agent->goto_create_ticket($q), "go to create ticket";
- $agent->submit_form(
- form_name => 'TicketCreate',
- fields => { Subject => 'test ip', }
- );
-
- my ($id) = $agent->content =~ /Ticket (\d+) created/;
- ok( $id, "created ticket $id" );
- my $cf_field = "Object-RT::Ticket-$id-CustomField-$cf_id-Values";
+ my $ip = 'abcd::034';
- $agent->follow_link_ok( { text => 'Basics', n => "1" },
- "Followed 'Basics' link" );
- $agent->form_number(3);
-
- is( $agent->value($cf_field), '', 'IP is empty' );
- $agent->field( $cf_field => $valid{$ip} );
- $agent->click('SubmitTicket');
-
- $agent->content_contains( $valid{$ip}, "IP on the page" );
-
- my $ticket = RT::Ticket->new($RT::SystemUser);
- $ticket->Load($id);
- ok( $ticket->id, 'loaded ticket' );
- my $values = $ticket->CustomFieldValues('IP');
- is( $ticket->FirstCustomFieldValue('IP'), $valid{$ip},
- 'correct value' );
-
- diag "set IP with spaces around" if $ENV{'TEST_VERBOSE'};
- my $new_ip = '::3141';
- my $new_value = '0000:' x 7 . '3141';
-
- $agent->follow_link_ok( { text => 'Basics', n => "1" },
- "Followed 'Basics' link" );
- $agent->form_number(3);
- is( $agent->value($cf_field), $valid{$ip}, 'IP is in input box' );
- $agent->field( $cf_field => $new_ip );
- $agent->click('SubmitTicket');
-
- $agent->content_contains( $new_value, "IP on the page" );
+ ok $agent->goto_create_ticket($q), "go to create ticket";
+ $agent->submit_form(
+ form_name => 'TicketCreate',
+ fields => { Subject => 'test ip', }
+ );
- $ticket = RT::Ticket->new($RT::SystemUser);
- $ticket->Load($id);
- ok( $ticket->id, 'loaded ticket' );
- is( $ticket->FirstCustomFieldValue('IP'), $new_value, 'correct value' );
- }
+ my ($id) = $agent->content =~ /Ticket (\d+) created/;
+ ok( $id, "created ticket $id" );
+ my $cf_field = "Object-RT::Ticket-$id-CustomField-$cf_id-Values";
+
+ $agent->follow_link_ok( { text => 'Basics', n => "1" },
+ "Followed 'Basics' link" );
+ $agent->form_number(3);
+
+ is( $agent->value($cf_field), '', 'IP is empty' );
+ $agent->field( $cf_field => $valid{$ip} );
+ $agent->click('SubmitTicket');
+
+ $agent->content_contains( $valid{$ip}, "IP on the page" );
+
+ my $ticket = RT::Ticket->new($RT::SystemUser);
+ $ticket->Load($id);
+ ok( $ticket->id, 'loaded ticket' );
+ my $values = $ticket->CustomFieldValues('IP');
+ is( $ticket->FirstCustomFieldValue('IP'), $valid{$ip}, 'correct value' );
+
+ diag "set IP with spaces around" if $ENV{'TEST_VERBOSE'};
+ my $new_ip = '::3141';
+ my $new_value = '0000:' x 7 . '3141';
+
+ $agent->follow_link_ok( { text => 'Basics', n => "1" },
+ "Followed 'Basics' link" );
+ $agent->form_number(3);
+ is( $agent->value($cf_field), $valid{$ip}, 'IP is in input box' );
+ $agent->field( $cf_field => $new_ip );
+ $agent->click('SubmitTicket');
+
+ $agent->content_contains( $new_value, "IP on the page" );
+
+ $ticket = RT::Ticket->new($RT::SystemUser);
+ $ticket->Load($id);
+ ok( $ticket->id, 'loaded ticket' );
+ is( $ticket->FirstCustomFieldValue('IP'), $new_value, 'correct value' );
}
diag "check that we parse correct IPs only" if $ENV{'TEST_VERBOSE'};
@@ -151,32 +154,6 @@ diag "check that we parse correct IPs only" if $ENV{'TEST_VERBOSE'};
}
}
-diag "search tickets by IP" if $ENV{'TEST_VERBOSE'};
-{
- for my $ip ( keys %valid ) {
- 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 => 'test ip',
- $cf_field => $ip,
- }
- );
-
- my ($id) = $agent->content =~ /Ticket (\d+) created/;
- ok( $id, "created ticket $id" );
-
- my $ticket = RT::Ticket->new($RT::SystemUser);
- $ticket->Load($id);
- ok( $ticket->id, 'loaded ticket' );
-
- my $tickets = RT::Tickets->new($RT::SystemUser);
- $tickets->FromSQL("id = $id AND CF.{IP} = '$ip'");
- ok( $tickets->Count, "found tickets" );
- }
-}
-
diag "create two tickets with different IPs and check several searches"
if $ENV{'TEST_VERBOSE'};
{
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list