[Rt-commit] r6221 - in rtir/branches/2.1-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Wed Oct 18 15:55:16 EDT 2006
Author: ruz
Date: Wed Oct 18 15:55:14 2006
New Revision: 6221
Modified:
rtir/branches/2.1-EXPERIMENTAL/ (props changed)
rtir/branches/2.1-EXPERIMENTAL/t/013-custom-field-ip.t
rtir/branches/2.1-EXPERIMENTAL/t/rtir-test.pl
Log:
r1726 at cubic-pc: cubic | 2006-10-19 00:03:16 +0400
* more tests for IPs
Modified: rtir/branches/2.1-EXPERIMENTAL/t/013-custom-field-ip.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/013-custom-field-ip.t (original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/013-custom-field-ip.t Wed Oct 18 15:55:14 2006
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 185;
+use Test::More tests => 219;
require "t/rtir-test.pl";
@@ -97,6 +97,49 @@
}
}
+diag "check that we parse correct IPs only" if $ENV{'TEST_VERBOSE'};
+{
+ my $id = create_ir( $agent, { Subject => "test ip", Content => '1.0.0.0' } );
+ ok($id, "created a ticket");
+
+ my $ticket = RT::Ticket->new( $RT::SystemUser );
+ $ticket->Load( $id );
+ is( $ticket->id, $id, 'loaded ticket' );
+
+ my %has = ();
+ $has{ $_->Content }++ foreach @{ $ticket->CustomFieldValues('_RTIR_IP')->ItemsArrayRef };
+ is(scalar values %has, 1, "one IP was added");
+ ok($has{'1.0.0.0'}, 'correct value');
+
+ $id = create_ir( $agent, { Subject => "test ip", Content => '255.255.255.255' } );
+ ok($id, "created a ticket");
+
+ $ticket = RT::Ticket->new( $RT::SystemUser );
+ $ticket->Load( $id );
+ is($ticket->id, $id, 'loaded ticket');
+
+ %has = ();
+ $has{ $_->Content }++ foreach @{ $ticket->CustomFieldValues('_RTIR_IP')->ItemsArrayRef };
+ is(scalar values %has, 1, "one IP was added");
+ ok($has{'255.255.255.255'}, 'correct value');
+
+ $id = create_ir( $agent, { Subject => "test ip", Content => '255.255.255.256' } );
+ ok($id, "created a ticket");
+
+ $ticket = RT::Ticket->new( $RT::SystemUser );
+ $ticket->Load( $id );
+ is($ticket->id, $id, 'loaded ticket');
+ is($ticket->CustomFieldValues('_RTIR_IP')->Count, 0, "IP wasn't added");
+
+ $id = create_ir( $agent, { Subject => "test ip", Content => '355.255.255.255' } );
+ ok($id, "created a ticket");
+
+ $ticket = RT::Ticket->new( $RT::SystemUser );
+ $ticket->Load( $id );
+ is($ticket->id, $id, 'loaded ticket');
+ is($ticket->CustomFieldValues('_RTIR_IP')->Count, 0, "IP wasn't added");
+}
+
diag "check that IPs in messages don't add duplicates" if $ENV{'TEST_VERBOSE'};
{
my $id = create_ir( $agent, {
Modified: rtir/branches/2.1-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/rtir-test.pl (original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/rtir-test.pl Wed Oct 18 15:55:14 2006
@@ -175,7 +175,7 @@
$agent->follow_link_ok({text => "New ". $type{ $queue }, n => "1"}, "Followed 'New $type{$queue}' link");
# set the form
- $agent->form_number(2);
+ $agent->form_number(3);
$fields->{'Requestors'} ||= $RTIR_TEST_USER if $queue eq 'Investigations';
More information about the Rt-commit
mailing list