[Rt-commit] r19986 - in rtir/2.5/trunk: lib/RT/IR lib/RT/IR/Test t t/constituency t/incident
ruz at bestpractical.com
ruz at bestpractical.com
Tue Jun 16 23:51:35 EDT 2009
Author: ruz
Date: Tue Jun 16 23:51:35 2009
New Revision: 19986
Modified:
rtir/2.5/trunk/lib/RT/IR/Test.pm
rtir/2.5/trunk/lib/RT/IR/Test/Web.pm
rtir/2.5/trunk/t/001-basic-RTIR.t
rtir/2.5/trunk/t/002-test-reject.t
rtir/2.5/trunk/t/003-resolve-IR-when-all-incidents-resolved.t
rtir/2.5/trunk/t/004-rtfm-in-rtir.t
rtir/2.5/trunk/t/005-resolve-investigations.t
rtir/2.5/trunk/t/006-saved-searches.t
rtir/2.5/trunk/t/008-workflow-blocks.t
rtir/2.5/trunk/t/009-attachments-processing.t
rtir/2.5/trunk/t/010-bulk-reject.t
rtir/2.5/trunk/t/011-merge.t
rtir/2.5/trunk/t/013-custom-field-ip.t
rtir/2.5/trunk/t/015-make-clicky.t
rtir/2.5/trunk/t/016-date-started.t
rtir/2.5/trunk/t/019-watchers-on-create.t
rtir/2.5/trunk/t/019-webui-block-fields.t
rtir/2.5/trunk/t/020-incident-and-investigation.t
rtir/2.5/trunk/t/023-gnupg-on-incident.t
rtir/2.5/trunk/t/constituency/basics.t
rtir/2.5/trunk/t/constituency/email.t
rtir/2.5/trunk/t/constituency/email_outgoing.t
rtir/2.5/trunk/t/constituency/propagation-inherit.t
rtir/2.5/trunk/t/constituency/propagation-no.t
rtir/2.5/trunk/t/constituency/propagation-reject.t
rtir/2.5/trunk/t/incident/abandon.t
rtir/2.5/trunk/t/incident/bulk-abandon.t
rtir/2.5/trunk/t/incident/split.t
rtir/2.5/trunk/t/mail/skip_notification.t
Log:
* move most functions into ::Test::Web and make them methods
Modified: rtir/2.5/trunk/lib/RT/IR/Test.pm
==============================================================================
--- rtir/2.5/trunk/lib/RT/IR/Test.pm (original)
+++ rtir/2.5/trunk/lib/RT/IR/Test.pm Tue Jun 16 23:51:35 2009
@@ -15,26 +15,7 @@
our @EXPORT = qw(
default_agent
- set_custom_field
- display_ticket
- ticket_state
- ticket_state_is
- ticket_is_linked_to_inc
- ticket_is_not_linked_to_inc
rtir_user
- create_incident
- create_ir
- create_investigation
- create_block
- goto_create_rtir_ticket
- create_rtir_ticket_ok
- create_rtir_ticket
- get_ticket_id
- create_incident_for_ir
- ok_and_content_like
- LinkChildToIncident
- merge_ticket
- create_incident_and_investigation
);
sub import_extra {
@@ -98,8 +79,8 @@
require RT::IR;
}
-my $RTIR_TEST_USER = "rtir_test_user";
-my $RTIR_TEST_PASS = "rtir_test_pass";
+our $RTIR_TEST_USER = "rtir_test_user";
+our $RTIR_TEST_PASS = "rtir_test_pass";
sub default_agent {
my $agent = new RT::IR::Test::Web;
@@ -111,90 +92,6 @@
return $agent;
}
-sub set_custom_field {
- my $agent = shift;
- my $queue = shift;
- my $cf_name = shift;
- my $val = shift;
-
- my $cf_obj = RT::CustomField->new( $RT::SystemUser );
- $cf_obj->LoadByName( Queue => $queue, Name => $cf_name );
- unless ( $cf_obj->id ) {
- Test::More::diag("Can not load custom field '$cf_name' in queue '$queue'");
- return 0;
- }
- my $cf_id = $cf_obj->id;
-
- my ($field_name) =
- grep /^Object-RT::Ticket-\d*-CustomField-$cf_id-Values?$/,
- map $_->name,
- $agent->current_form->inputs;
- unless ( $field_name ) {
- Test::More::diag("Can not find input for custom field '$cf_name' #$cf_id");
- return 0;
- }
-
- $agent->field($field_name, $val);
- return 1;
-}
-
-sub display_ticket {
- my $agent = shift;
- my $id = shift;
-
- $agent->get_ok("/RTIR/Display.html?id=$id", "Loaded Display page for Ticket #$id");
-}
-
-sub ticket_state {
- my $agent = shift;
- my $id = shift;
-
- display_ticket($agent, $id);
- my ($got) = ($agent->content =~ qr{State:\s*</td>\s*<td[^>]*?class="value"[^>]*?>\s*([\w ]+?)\s*</td>}ism);
- unless ( $got ) {
- Test::More::diag("Error: couldn't find state value on the page, may be regexp problem");
- }
- return $got;
-}
-
-sub ticket_state_is {
- my $agent = shift;
- my $id = shift;
- my $state = shift;
- my $desc = shift || "State of the ticket #$id is '$state'";
- return Test::More::is(ticket_state($agent, $id), $state, $desc);
-}
-
-sub ticket_is_linked_to_inc {
- my $agent = shift;
- my $id = shift;
- my $incs = shift;
- display_ticket( $agent, $id );
- foreach my $inc( ref $incs? @$incs : ($incs) ) {
- my $desc = shift || "Ticket #$id is linked to the Incident #$inc";
- $agent->content_like(
- qr{Incident:\s*</td>\s*<td[^>]*?>.*?<a\s+href="/RTIR/Display.html\?id=\Q$inc\E">\Q$inc\E:\s+}ism,
- $desc
- ) or return 0;
- }
- return 1;
-}
-
-sub ticket_is_not_linked_to_inc {
- my $agent = shift;
- my $id = shift;
- my $incs = shift;
- display_ticket( $agent, $id );
- foreach my $inc( @$incs ) {
- my $desc = shift || "Ticket #$id is not linked to the Incident #$inc";
- $agent->content_unlike(
- qr{Incident:\s*</td>\s*<td[^>]*?>.*?<a\s+href="/RTIR/Display.html\?id=\Q$inc\E">\Q$inc\E:\s+}ism,
- $desc
- ) or return 0;
- }
- return 1;
-}
-
sub rtir_user {
return RT::Test->load_or_create_user(
Name => $RTIR_TEST_USER,
@@ -205,270 +102,4 @@
);
}
-sub create_incident {
- return create_rtir_ticket_ok( shift, 'Incidents', @_ );
-}
-sub create_ir {
- return create_rtir_ticket_ok( shift, 'Incident Reports', @_ );
-}
-sub create_investigation {
- return create_rtir_ticket_ok( shift, 'Investigations', @_ );
-}
-sub create_block {
- return create_rtir_ticket_ok( shift, 'Blocks', @_ );
-}
-
-sub goto_create_rtir_ticket {
- my $agent = shift;
- my $queue = shift;
-
- my %type = (
- 'Incident Reports' => 'Report',
- 'Investigations' => 'Investigation',
- 'Blocks' => 'Block',
- 'Incidents' => 'Incident'
- );
-
- $agent->get_ok("/RTIR/index.html", "Loaded home page");
- $agent->follow_link_ok({text => $queue, n => "1"}, "Followed '$queue' link");
- $agent->follow_link_ok({text => "New ". $type{ $queue }, n => "1"}, "Followed 'New $type{$queue}' link");
-
-
- # set the form
- $agent->form_number(3);
-}
-
-sub create_rtir_ticket_ok {
- my $agent = shift;
- my $queue = shift;
-
- my $id = create_rtir_ticket( $agent, $queue, @_ );
- Test::More::ok( $id, "Created ticket #$id in queue '$queue' successfully." );
- return $id;
-}
-
-sub create_rtir_ticket
-{
- my $agent = shift;
- my $queue = shift;
- my $fields = shift || {};
- my $cfs = shift || {};
-
- goto_create_rtir_ticket($agent, $queue);
-
- #Enable test scripts to pass in the name of the owner rather than the ID
- if ($$fields{Owner} && $$fields{Owner} !~ /^\d+$/)
- {
- if($agent->content =~ qr{<option.+?value="(\d+)"\s*>$$fields{Owner}</option>}ims) {
- $$fields{Owner} = $1;
- }
- }
-
-
- $fields->{'Requestors'} ||= $RTIR_TEST_USER if $queue eq 'Investigations';
- while (my ($f, $v) = each %$fields) {
- $agent->field($f, $v);
- }
-
- while (my ($f, $v) = each %$cfs) {
- set_custom_field($agent, $queue, $f, $v);
- }
-
- my %create = (
- 'Incident Reports' => 'Create',
- 'Investigations' => 'Create',
- 'Blocks' => 'Create',
- 'Incidents' => 'CreateIncident'
- );
- # Create it!
- $agent->click( $create{ $queue } );
-
- Test::More::is ($agent->status, 200, "Attempted to create the ticket");
-
- return get_ticket_id($agent);
-}
-
-sub get_ticket_id {
- my $agent = shift;
- my $content = $agent->content();
- my $id = 0;
- if ($content =~ /.*Ticket (\d+) created.*/g) {
- $id = $1;
- }
- elsif ($content =~ /.*No permission to view newly created ticket #(\d+).*/g) {
- Test::More::diag("\nNo permissions to view the ticket.\n") if($ENV{'TEST_VERBOSE'});
- $id = $1;
- }
- return $id;
-}
-
-
-sub create_incident_for_ir {
- my $agent = shift;
- my $ir_id = shift;
- my $fields = shift || {};
- my $cfs = shift || {};
-
- display_ticket($agent, $ir_id);
-
- # Select the "New" link from the Display page
- $agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link")
- or diag $agent->content;
-
- $agent->form_number(3);
-
- while (my ($f, $v) = each %$fields) {
- $agent->field($f, $v);
- }
-
- while (my ($f, $v) = each %$cfs) {
- set_custom_field($agent, 'Incidents', $f, $v);
- }
-
- $agent->click("CreateIncident");
-
- Test::More::is ($agent->status, 200, "Attempting to create new incident linked to child $ir_id");
-
- Test::More::ok ($agent->content =~ /.*Ticket (\d+) created in queue.*/g, "Incident created from child $ir_id.");
- my $incident_id = $1;
-
-# diag("incident ID is $incident_id");
- return $incident_id;
-}
-
-sub ok_and_content_like {
- my $agent = shift;
- my $re = shift;
- my $desc = shift || "looks good";
-
- Test::More::is($agent->status, 200, "request successful");
- #like($agent->content, $re, $desc);
- $agent->content_like($re, $desc);
-}
-
-
-sub LinkChildToIncident {
-
- my $agent = shift;
- my $id = shift;
- my $incident = shift;
-
- display_ticket($agent, $id);
-
- # Select the "Link" link from the Display page
- $agent->follow_link_ok({text => "[Link]", n => "1"}, "Followed 'Link(to Incident)' link");
-
-
- # Check that the desired incident occurs in the list of available incidents; if not, keep
- # going to the next page until you find it (or get to the last page and don't find it,
- # whichever comes first)
- while($agent->content() !~ m|<a href="/Ticket/Display.html\?id=$incident">$incident</a>|) {
- last unless $agent->follow_link(text => 'Next');
- }
-
- $agent->form_number(3);
-
- $agent->field("SelectedTicket", $incident);
-
- $agent->click("LinkChild");
-
- Test::More::is ($agent->status, 200, "Attempting to link child $id to Incident $incident");
-
- Test::More::ok ($agent->content =~ /Ticket\s+$id:\s*Ticket\s+$id\s+member\s+of\s+Ticket\s+$incident/gs, "Incident $incident linked successfully.");
-
- return;
-}
-
-
-sub merge_ticket {
- my $agent = shift;
- my $id = shift;
- my $id_to_merge_to = shift;
-
- display_ticket($agent, $id);
-
- $agent->timeout(600);
-
- $agent->follow_link_ok({text => 'Merge', n => '1'}, "Followed 'Merge' link");
-
- $agent->content() =~ /Merge ([\w ]+) #$id:/i;
- my $type = $1 || 'Ticket';
-
-
- # Check that the desired incident occurs in the list of available incidents; if not, keep
- # going to the next page until you find it (or get to the last page and don't find it,
- # whichever comes first)
- while($agent->content() !~ m|<a href="/Ticket/Display.html\?id=$id_to_merge_to">$id_to_merge_to</a>|) {
- my @ids = sort map s|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|$1|, split /<td/, $agent->content();
- my $max = pop @ids;
- my $url = "Merge.html?id=$id&Order=ASC&Query=( 'CF.{State}' = 'new' OR 'CF.{State}' = 'open' AND 'id' > $max)";
- my $weburl = RT->Config->Get('WebURL');
- Test::More::diag("IDs found: " . join ', ', @ids);
- Test::More::diag("Max ID: " . $max);
- Test::More::diag ("URL: " . $url);
- $agent->get("$weburl/RTIR/$url");
- last unless $agent->content() =~ qr|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|sm;
- }
-
-
- $agent->form_number(3);
-
-
- $agent->field("SelectedTicket", $id_to_merge_to);
- $agent->click_button(value => 'Merge');
-
- Test::More::is ($agent->status, 200, "Attempting to merge $type #$id to ticket #$id_to_merge_to");
-
- $agent->content_like(qr{.*<ul class="action-results">\s*<li>Merge Successful</li>.*}i,
- "Successfully merged $type #$id to ticket #$id_to_merge_to");
-}
-
-
-sub create_incident_and_investigation {
- my $agent = shift;
- my $fields = shift || {};
- my $cfs = shift || {};
- my $ir_id = shift;
-
- $ir_id ? display_ticket($agent, $ir_id)
- : $agent->get_ok("/RTIR/index.html", "Loaded home page");
-
- if($ir_id) {
- # Select the "New" link from the Display page
- $agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
- }
- else
- {
- $agent->follow_link_ok({text => "Incidents"}, "Followed 'Incidents' link");
- $agent->follow_link_ok({text => "New Incident", n => '1'}, "Followed 'New Incident' link");
- }
-
- # Fill out forms
- $agent->form_number(3);
-
- while (my ($f, $v) = each %$fields) {
- $agent->field($f, $v);
- }
-
- while (my ($f, $v) = each %$cfs) {
- set_custom_field($agent, 'Incidents', $f, $v);
- }
- $agent->click("CreateWithInvestigation");
- my $msg = $ir_id
- ? "Attempting to create new incident and investigation linked to child $ir_id"
- : "Attempting to create new incident and investigation";
- Test::More::is ($agent->status, 200, $msg);
- $msg = $ir_id ? "Incident created from child $ir_id." : "Incident created.";
-
- my $re = qr/.*Ticket (\d+) created in queue 'Incidents'/;
- $agent->content_like( $re, $msg );
- my ($incident_id) = ($agent->content =~ $re);
-
- $re = qr/.*Ticket (\d+) created in queue 'Investigations'/;
- $agent->content_like( $re, "Investigation created for Incident $incident_id." );
- my ($investigation_id) = ($agent->content =~ $re);
-
- return ($incident_id, $investigation_id);
-}
-
1;
Modified: rtir/2.5/trunk/lib/RT/IR/Test/Web.pm
==============================================================================
--- rtir/2.5/trunk/lib/RT/IR/Test/Web.pm (original)
+++ rtir/2.5/trunk/lib/RT/IR/Test/Web.pm Tue Jun 16 23:51:35 2009
@@ -8,4 +8,353 @@
require RT::IR::Test;
require Test::More;
+sub create_incident {
+ return (shift)->create_rtir_ticket_ok( 'Incidents', @_ );
+}
+sub create_ir {
+ return (shift)->create_rtir_ticket_ok( 'Incident Reports', @_ );
+}
+sub create_investigation {
+ return (shift)->create_rtir_ticket_ok( 'Investigations', @_ );
+}
+sub create_block {
+ return (shift)->create_rtir_ticket_ok( 'Blocks', @_ );
+}
+
+sub goto_create_rtir_ticket {
+ my $self = shift;
+ my $queue = shift;
+
+ my %type = (
+ 'Incident Reports' => 'Report',
+ 'Investigations' => 'Investigation',
+ 'Blocks' => 'Block',
+ 'Incidents' => 'Incident'
+ );
+
+ $self->get_ok("/RTIR/index.html", "Loaded home page");
+ $self->follow_link_ok({text => $queue, n => "1"}, "Followed '$queue' link");
+ $self->follow_link_ok({text => "New ". $type{ $queue }, n => "1"}, "Followed 'New $type{$queue}' link");
+
+
+ # set the form
+ $self->form_number(3);
+}
+
+sub create_rtir_ticket_ok {
+ my $self = shift;
+ my $queue = shift;
+
+ my $id = $self->create_rtir_ticket( $queue, @_ );
+ Test::More::ok( $id, "Created ticket #$id in queue '$queue' successfully." );
+ return $id;
+}
+
+sub create_rtir_ticket
+{
+ my $self = shift;
+ my $queue = shift;
+ my $fields = shift || {};
+ my $cfs = shift || {};
+
+ $self->goto_create_rtir_ticket($queue);
+
+ #Enable test scripts to pass in the name of the owner rather than the ID
+ if ($$fields{Owner} && $$fields{Owner} !~ /^\d+$/)
+ {
+ if($self->content =~ qr{<option.+?value="(\d+)"\s*>$$fields{Owner}</option>}ims) {
+ $$fields{Owner} = $1;
+ }
+ }
+
+
+ $fields->{'Requestors'} ||= $RT::IR::Test::RTIR_TEST_USER if $queue eq 'Investigations';
+ while (my ($f, $v) = each %$fields) {
+ $self->field($f, $v);
+ }
+
+ while (my ($f, $v) = each %$cfs) {
+ $self->set_custom_field($queue, $f, $v);
+ }
+
+ my %create = (
+ 'Incident Reports' => 'Create',
+ 'Investigations' => 'Create',
+ 'Blocks' => 'Create',
+ 'Incidents' => 'CreateIncident'
+ );
+ # Create it!
+ $self->click( $create{ $queue } );
+
+ Test::More::is ($self->status, 200, "Attempted to create the ticket");
+
+ return $self->get_ticket_id;
+}
+
+sub get_ticket_id {
+ my $self = shift;
+ my $content = $self->content;
+ my $id = 0;
+ if ($content =~ /.*Ticket (\d+) created.*/g) {
+ $id = $1;
+ }
+ elsif ($content =~ /.*No permission to view newly created ticket #(\d+).*/g) {
+ Test::More::diag("\nNo permissions to view the ticket.\n") if($ENV{'TEST_VERBOSE'});
+ $id = $1;
+ }
+ return $id;
+}
+
+sub create_incident_for_ir {
+ my $self = shift;
+ my $ir_id = shift;
+ my $fields = shift || {};
+ my $cfs = shift || {};
+
+ $self->display_ticket( $ir_id );
+
+ # Select the "New" link from the Display page
+ $self->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link")
+ or diag $self->content;
+
+ $self->form_number(3);
+
+ while (my ($f, $v) = each %$fields) {
+ $self->field($f, $v);
+ }
+
+ while (my ($f, $v) = each %$cfs) {
+ $self->set_custom_field( 'Incidents', $f, $v);
+ }
+
+ $self->click("CreateIncident");
+
+ Test::More::is ($self->status, 200, "Attempting to create new incident linked to child $ir_id");
+
+ Test::More::ok ($self->content =~ /.*Ticket (\d+) created in queue.*/g, "Incident created from child $ir_id.");
+ my $incident_id = $1;
+
+# diag("incident ID is $incident_id");
+ return $incident_id;
+}
+
+sub set_custom_field {
+ my $self = shift;
+ my $queue = shift;
+ my $cf_name = shift;
+ my $val = shift;
+
+ my $cf_obj = RT::CustomField->new( $RT::SystemUser );
+ $cf_obj->LoadByName( Queue => $queue, Name => $cf_name );
+ unless ( $cf_obj->id ) {
+ Test::More::diag("Can not load custom field '$cf_name' in queue '$queue'");
+ return 0;
+ }
+ my $cf_id = $cf_obj->id;
+
+ my ($field_name) =
+ grep /^Object-RT::Ticket-\d*-CustomField-$cf_id-Values?$/,
+ map $_->name,
+ $self->current_form->inputs;
+ unless ( $field_name ) {
+ Test::More::diag("Can not find input for custom field '$cf_name' #$cf_id");
+ return 0;
+ }
+
+ $self->field($field_name, $val);
+ return 1;
+}
+
+sub display_ticket {
+ my $self = shift;
+ my $id = shift;
+
+ $self->get_ok("/RTIR/Display.html?id=$id", "Loaded Display page for Ticket #$id");
+}
+
+sub ticket_state {
+ my $self = shift;
+ my $id = shift;
+
+ $self->display_ticket( $id);
+ my ($got) = ($self->content =~ qr{State:\s*</td>\s*<td[^>]*?class="value"[^>]*?>\s*([\w ]+?)\s*</td>}ism);
+ unless ( $got ) {
+ Test::More::diag("Error: couldn't find state value on the page, may be regexp problem");
+ }
+ return $got;
+}
+
+sub ticket_state_is {
+ my $self = shift;
+ my $id = shift;
+ my $state = shift;
+ my $desc = shift || "State of the ticket #$id is '$state'";
+ return Test::More::is($self->ticket_state( $id), $state, $desc);
+}
+
+sub ticket_is_linked_to_inc {
+ my $self = shift;
+ my $id = shift;
+ my $incs = shift;
+ $self->display_ticket( $id );
+ foreach my $inc( ref $incs? @$incs : ($incs) ) {
+ my $desc = shift || "Ticket #$id is linked to the Incident #$inc";
+ $self->content_like(
+ qr{Incident:\s*</td>\s*<td[^>]*?>.*?<a\s+href="/RTIR/Display.html\?id=\Q$inc\E">\Q$inc\E:\s+}ism,
+ $desc
+ ) or return 0;
+ }
+ return 1;
+}
+
+sub ticket_is_not_linked_to_inc {
+ my $self = shift;
+ my $id = shift;
+ my $incs = shift;
+ $self->display_ticket( $id );
+ foreach my $inc( @$incs ) {
+ my $desc = shift || "Ticket #$id is not linked to the Incident #$inc";
+ $self->content_unlike(
+ qr{Incident:\s*</td>\s*<td[^>]*?>.*?<a\s+href="/RTIR/Display.html\?id=\Q$inc\E">\Q$inc\E:\s+}ism,
+ $desc
+ ) or return 0;
+ }
+ return 1;
+}
+
+sub ok_and_content_like {
+ my $self = shift;
+ my $re = shift;
+ my $desc = shift || "looks good";
+
+ Test::More::is($self->status, 200, "request successful");
+ #like($self->content, $re, $desc);
+ $self->content_like($re, $desc);
+}
+
+
+sub LinkChildToIncident {
+
+ my $self = shift;
+ my $id = shift;
+ my $incident = shift;
+
+ $self->display_ticket( $id);
+
+ # Select the "Link" link from the Display page
+ $self->follow_link_ok({text => "[Link]", n => "1"}, "Followed 'Link(to Incident)' link");
+
+
+ # Check that the desired incident occurs in the list of available incidents; if not, keep
+ # going to the next page until you find it (or get to the last page and don't find it,
+ # whichever comes first)
+ while($self->content() !~ m|<a href="/Ticket/Display.html\?id=$incident">$incident</a>|) {
+ last unless $self->follow_link(text => 'Next');
+ }
+
+ $self->form_number(3);
+
+ $self->field("SelectedTicket", $incident);
+
+ $self->click("LinkChild");
+
+ Test::More::is ($self->status, 200, "Attempting to link child $id to Incident $incident");
+
+ Test::More::ok ($self->content =~ /Ticket\s+$id:\s*Ticket\s+$id\s+member\s+of\s+Ticket\s+$incident/gs, "Incident $incident linked successfully.");
+
+ return;
+}
+
+
+sub merge_ticket {
+ my $self = shift;
+ my $id = shift;
+ my $id_to_merge_to = shift;
+
+ $self->display_ticket( $id);
+
+ $self->timeout(600);
+
+ $self->follow_link_ok({text => 'Merge', n => '1'}, "Followed 'Merge' link");
+
+ $self->content() =~ /Merge ([\w ]+) #$id:/i;
+ my $type = $1 || 'Ticket';
+
+
+ # Check that the desired incident occurs in the list of available incidents; if not, keep
+ # going to the next page until you find it (or get to the last page and don't find it,
+ # whichever comes first)
+ while($self->content() !~ m|<a href="/Ticket/Display.html\?id=$id_to_merge_to">$id_to_merge_to</a>|) {
+ my @ids = sort map s|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|$1|, split /<td/, $self->content();
+ my $max = pop @ids;
+ my $url = "Merge.html?id=$id&Order=ASC&Query=( 'CF.{State}' = 'new' OR 'CF.{State}' = 'open' AND 'id' > $max)";
+ my $weburl = RT->Config->Get('WebURL');
+ Test::More::diag("IDs found: " . join ', ', @ids);
+ Test::More::diag("Max ID: " . $max);
+ Test::More::diag ("URL: " . $url);
+ $self->get("$weburl/RTIR/$url");
+ last unless $self->content() =~ qr|<b>\s*<a href="/Ticket/Display.html?id=(\d+)">\1</a>\s*</b>|sm;
+ }
+
+
+ $self->form_number(3);
+
+
+ $self->field("SelectedTicket", $id_to_merge_to);
+ $self->click_button(value => 'Merge');
+
+ Test::More::is ($self->status, 200, "Attempting to merge $type #$id to ticket #$id_to_merge_to");
+
+ $self->content_like(qr{.*<ul class="action-results">\s*<li>Merge Successful</li>.*}i,
+ "Successfully merged $type #$id to ticket #$id_to_merge_to");
+}
+
+
+sub create_incident_and_investigation {
+ my $self = shift;
+ my $fields = shift || {};
+ my $cfs = shift || {};
+ my $ir_id = shift;
+
+ $ir_id ? $self->display_ticket( $ir_id)
+ : $self->get_ok("/RTIR/index.html", "Loaded home page");
+
+ if($ir_id) {
+ # Select the "New" link from the Display page
+ $self->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
+ }
+ else
+ {
+ $self->follow_link_ok({text => "Incidents"}, "Followed 'Incidents' link");
+ $self->follow_link_ok({text => "New Incident", n => '1'}, "Followed 'New Incident' link");
+ }
+
+ # Fill out forms
+ $self->form_number(3);
+
+ while (my ($f, $v) = each %$fields) {
+ $self->field($f, $v);
+ }
+
+ while (my ($f, $v) = each %$cfs) {
+ $self->set_custom_field( 'Incidents', $f, $v);
+ }
+ $self->click("CreateWithInvestigation");
+ my $msg = $ir_id
+ ? "Attempting to create new incident and investigation linked to child $ir_id"
+ : "Attempting to create new incident and investigation";
+ Test::More::is ($self->status, 200, $msg);
+ $msg = $ir_id ? "Incident created from child $ir_id." : "Incident created.";
+
+ my $re = qr/.*Ticket (\d+) created in queue 'Incidents'/;
+ $self->content_like( $re, $msg );
+ my ($incident_id) = ($self->content =~ $re);
+
+ $re = qr/.*Ticket (\d+) created in queue 'Investigations'/;
+ $self->content_like( $re, "Investigation created for Incident $incident_id." );
+ my ($investigation_id) = ($self->content =~ $re);
+
+ return ($incident_id, $investigation_id);
+}
+
1;
Modified: rtir/2.5/trunk/t/001-basic-RTIR.t
==============================================================================
--- rtir/2.5/trunk/t/001-basic-RTIR.t (original)
+++ rtir/2.5/trunk/t/001-basic-RTIR.t Tue Jun 16 23:51:35 2009
@@ -11,7 +11,7 @@
my $SUBJECT = "foo " . rand;
# Create a report
-my $report = create_ir($agent, {Subject => $SUBJECT, Content => "bla" });
+my $report = $agent->create_ir( {Subject => $SUBJECT, Content => "bla" });
{
my $ir_obj = RT::Ticket->new(RT::SystemUser());
@@ -23,7 +23,7 @@
# Create a new Incident from that report
-my $first_incident_id = create_incident_for_ir($agent, $report, {Subject => "first incident"},
+my $first_incident_id = $agent->create_incident_for_ir( $report, {Subject => "first incident"},
{Function => "IncidentCoord"});
# TODO: make sure subject and content come from Report
@@ -33,10 +33,10 @@
# TODO: make sure all fields are set properly in DB
# create a new incident
-my $second_incident_id = create_incident( $agent, { Subject => "foo Incident", Content => "bar baz quux" } );
+my $second_incident_id = $agent->create_incident( { Subject => "foo Incident", Content => "bar baz quux" } );
# link our report to that incident
-LinkChildToIncident($agent, $report, $second_incident_id);
+$agent->LinkChildToIncident( $report, $second_incident_id);
# TODO: verify in DB that report has 1 parent, and the right parent
Modified: rtir/2.5/trunk/t/002-test-reject.t
==============================================================================
--- rtir/2.5/trunk/t/002-test-reject.t (original)
+++ rtir/2.5/trunk/t/002-test-reject.t Tue Jun 16 23:51:35 2009
@@ -15,10 +15,10 @@
# We are testing that the reject and quick reject buttons both work
# both for IRs that you own and IRs that are unowned. So we make four IRs to work with.
-my $nobody_slow = create_ir($agent, {Subject => "nobody slow", Owner => RT::Nobody()->Id });
-my $nobody_quick = create_ir($agent, {Subject => "nobody quick", Owner => RT::Nobody()->Id });
-my $me_slow = create_ir($agent, {Subject => "me slow", Owner => $rtir_user->Id });
-my $me_quick = create_ir($agent, {Subject => "me quick", Owner => $rtir_user->Id });
+my $nobody_slow = $agent->create_ir( {Subject => "nobody slow", Owner => RT::Nobody()->Id });
+my $nobody_quick = $agent->create_ir( {Subject => "nobody quick", Owner => RT::Nobody()->Id });
+my $me_slow = $agent->create_ir( {Subject => "me slow", Owner => $rtir_user->Id });
+my $me_quick = $agent->create_ir( {Subject => "me quick", Owner => $rtir_user->Id });
for my $id ($nobody_slow, $nobody_quick) {
@@ -36,14 +36,14 @@
}
for my $id ($nobody_quick, $me_quick) {
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Quick Reject"}, "Followed 'Quick Reject' link");
like($agent->content, qr/State changed from new to rejected/, "site says ticket got rejected");
}
for my $id ($nobody_slow, $me_slow) {
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Reject"}, "Followed 'Reject' link");
@@ -70,21 +70,21 @@
diag "test that after reject links to incidents are still there" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "test"});
- my $id = create_ir($agent, {Subject => "test", Incident => $inc_id});
+ my $inc_id = $agent->create_incident( {Subject => "test"});
+ my $id = $agent->create_ir( {Subject => "test", Incident => $inc_id});
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
$tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
is $tickets->Count, 1, 'have the link';
}
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Reject"}, "Followed 'Reject' link");
$agent->form_name("TicketUpdate");
$agent->field(UpdateContent => "why you are rejected");
$agent->click("SubmitTicket");
is $agent->status, 200, "attempt to reject succeeded";
- ticket_state_is( $agent, $id, 'rejected' );
+ $agent->ticket_state_is( $id, 'rejected' );
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
@@ -93,7 +93,7 @@
}
# go to incident and check that we still can see the child
- display_ticket($agent, $inc_id);
+ $agent->display_ticket( $inc_id);
$agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
$agent->form_number(3);
$agent->tick( States => 'rejected' );
@@ -104,17 +104,17 @@
diag "test that after quick reject links to incidents are still there" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "test"});
- my $id = create_ir($agent, {Subject => "test", Incident => $inc_id});
+ my $inc_id = $agent->create_incident( {Subject => "test"});
+ my $id = $agent->create_ir( {Subject => "test", Incident => $inc_id});
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
$tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
is $tickets->Count, 1, 'have the link';
}
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Quick Reject"}, "Followed 'Reject' link");
- ticket_state_is( $agent, $id, 'rejected' );
+ $agent->ticket_state_is( $id, 'rejected' );
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
@@ -123,7 +123,7 @@
}
# go to incident and check that we still can see the child
- display_ticket($agent, $inc_id);
+ $agent->display_ticket( $inc_id);
$agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
$agent->form_number(3);
$agent->tick( States => 'rejected' );
@@ -134,15 +134,15 @@
diag "test that after bulk reject links to incidents are still there" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "test"});
- my $id = create_ir($agent, {Subject => "test", Incident => $inc_id});
+ my $inc_id = $agent->create_incident( {Subject => "test"});
+ my $id = $agent->create_ir( {Subject => "test", Incident => $inc_id});
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
$tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
is $tickets->Count, 1, 'have the link';
}
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Incident Reports"}, "Followed 'Incident Reports' link");
while($agent->content() !~ m{Display.html\?id=$id">$id</a>}) {
last unless $agent->follow_link(text => 'Next');
@@ -153,7 +153,7 @@
$agent->tick( SelectedTickets => $id );
$agent->click('BulkReject');
- ticket_state_is( $agent, $id, 'rejected' );
+ $agent->ticket_state_is( $id, 'rejected' );
{
my $tickets = RT::Tickets->new( $RT::SystemUser );
@@ -162,7 +162,7 @@
}
# go to incident and check that we still can see the child
- display_ticket($agent, $inc_id);
+ $agent->display_ticket( $inc_id);
$agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
$agent->form_number(3);
$agent->tick( States => 'rejected' );
Modified: rtir/2.5/trunk/t/003-resolve-IR-when-all-incidents-resolved.t
==============================================================================
--- rtir/2.5/trunk/t/003-resolve-IR-when-all-incidents-resolved.t (original)
+++ rtir/2.5/trunk/t/003-resolve-IR-when-all-incidents-resolved.t Tue Jun 16 23:51:35 2009
@@ -8,28 +8,28 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $ir_id = create_ir($agent, {Subject => "resolves slowly"});
+my $ir_id = $agent->create_ir( {Subject => "resolves slowly"});
my $subj1 = "inc1_" . rand;
my $subj2 = "inc2_" . rand;
-my $inc_1 = create_incident_for_ir($agent, $ir_id, {Subject => $subj1});
-my $inc_2 = create_incident_for_ir($agent, $ir_id, {Subject => $subj2});
+my $inc_1 = $agent->create_incident_for_ir( $ir_id, {Subject => $subj1});
+my $inc_2 = $agent->create_incident_for_ir( $ir_id, {Subject => $subj2});
-display_ticket($agent, $ir_id);
+$agent->display_ticket( $ir_id);
like($agent->content, qr/\Q$subj1/, "we're linked to the first incident");
like($agent->content, qr/\Q$subj2/, "we're linked to the second incident");
ir_status('open');
-display_ticket($agent, $inc_1);
+$agent->display_ticket( $inc_1);
$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'Quick Resolve' link for first incident");
like($agent->content, qr/State changed from open to resolved/, "resolved the first incident");
ir_status('open');
-display_ticket($agent, $inc_2);
+$agent->display_ticket( $inc_2);
$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'Quick Resolve' link for second incident");
like($agent->content, qr/State changed from open to resolved/, "resolved the second incident");
Modified: rtir/2.5/trunk/t/004-rtfm-in-rtir.t
==============================================================================
--- rtir/2.5/trunk/t/004-rtfm-in-rtir.t (original)
+++ rtir/2.5/trunk/t/004-rtfm-in-rtir.t Tue Jun 16 23:51:35 2009
@@ -8,9 +8,9 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $ir_id = create_ir($agent, {Subject => "looking for rtfm"});
+my $ir_id = $agent->create_ir( {Subject => "looking for rtfm"});
-display_ticket($agent, $ir_id);
+$agent->display_ticket( $ir_id);
$agent->follow_link_ok({text => "RTFM"}, "followed 'RTFM' overview link");
$agent->title_like(qr/Overview/);
Modified: rtir/2.5/trunk/t/005-resolve-investigations.t
==============================================================================
--- rtir/2.5/trunk/t/005-resolve-investigations.t (original)
+++ rtir/2.5/trunk/t/005-resolve-investigations.t Tue Jun 16 23:51:35 2009
@@ -8,16 +8,16 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $inv_id = create_investigation($agent, {Subject => "i want to quick-resolve this"});
+my $inv_id = $agent->create_investigation( {Subject => "i want to quick-resolve this"});
-display_ticket($agent, $inv_id);
+$agent->display_ticket( $inv_id);
$agent->follow_link_ok({text => "Quick Resolve"}, "followed 'RTFM' overview link");
like($agent->content, qr/State changed from open to resolved/, "it got resolved");
-$inv_id = create_investigation($agent, {Subject => "resolve me slower"});
+$inv_id = $agent->create_investigation( {Subject => "resolve me slower"});
-display_ticket($agent, $inv_id);
+$agent->display_ticket( $inv_id);
$agent->follow_link_ok({text => "Resolve"}, "Followed 'Resolve' link");
Modified: rtir/2.5/trunk/t/006-saved-searches.t
==============================================================================
--- rtir/2.5/trunk/t/006-saved-searches.t (original)
+++ rtir/2.5/trunk/t/006-saved-searches.t Tue Jun 16 23:51:35 2009
@@ -19,7 +19,7 @@
$agent->field(ValueOfAttachment => $subj1);
$agent->click("AddClause");
-ok_and_content_like($agent, qr/Subject LIKE '$subj1/, "added new clause");
+$agent->ok_and_content_like( qr/Subject LIKE '$subj1/, "added new clause");
$agent->form_name("BuildQuery");
my $search1 = "saved".rand();
@@ -35,7 +35,7 @@
$agent->form_name("BuildQuery");
$agent->field(ValueOfid => 200);
$agent->click("AddClause");
-ok_and_content_like($agent, qr/AND id < 200/, "added another clause");
+$agent->ok_and_content_like( qr/AND id < 200/, "added another clause");
$agent->form_name("BuildQuery");
is($agent->value('SavedSearchDescription'), $search1, "name is correct");
Modified: rtir/2.5/trunk/t/008-workflow-blocks.t
==============================================================================
--- rtir/2.5/trunk/t/008-workflow-blocks.t (original)
+++ rtir/2.5/trunk/t/008-workflow-blocks.t Tue Jun 16 23:51:35 2009
@@ -8,10 +8,10 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $inc_id = create_incident($agent, {Subject => "incident with block"});
-my $block_id = create_block($agent, {Subject => "block", Incident => $inc_id});
+my $inc_id = $agent->create_incident( {Subject => "incident with block"});
+my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
-ticket_state_is($agent, $block_id, 'pending activation');
+$agent->ticket_state_is( $block_id, 'pending activation');
# XXX: Comment this tests as we don't allow to create blocks without an incident
# XXX: we need test for this fact
@@ -19,10 +19,10 @@
#$agent->form_number(3);
#$agent->field('SelectedTicket', $inc_id);
#$agent->click('LinkChild');
-#ok_and_content_like($agent, qr{$block_id.*block.*?pending activation}, 'have child link');
+#$agent->ok_and_content_like( qr{$block_id.*block.*?pending activation}, 'have child link');
#
#$agent->follow_link_ok({ text => $block_id }, "Followed link back to block");
-#ticket_state_is($agent, $block_id, 'pending activation');
+#$agent->ticket_state_is( $block_id, 'pending activation');
$agent->has_tag('a', 'Remove', 'we have Remove action');
$agent->has_tag('a', 'Quick Remove', 'we have Quick Remove action');
@@ -41,7 +41,7 @@
$agent->field(Status => $status);
$agent->click('SaveChanges');
my $state = $state{ $status };
- ticket_state_is($agent, $block_id, $state);
+ $agent->ticket_state_is( $block_id, $state);
}
diag "remove using edit";
@@ -56,7 +56,7 @@
$agent->field(Status => 'resolved');
$agent->click('SaveChanges');
- ticket_state_is($agent, $block_id, 'removed');
+ $agent->ticket_state_is( $block_id, 'removed');
}
diag "reactivate the block using the link";
@@ -67,7 +67,7 @@
$agent->form_number(3);
$agent->field( UpdateContent => 'activating block' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'active');
+ $agent->ticket_state_is( $block_id, 'active');
}
diag "prepare for removing using the link";
@@ -76,20 +76,20 @@
$agent->follow_link_ok({ text => 'Pending Removal' }, "Prepare block for remove");
$agent->form_number(3);
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'pending removal');
+ $agent->ticket_state_is( $block_id, 'pending removal');
}
diag "test activation after reply using 'Activate' link";
{
- my $block_id = create_block($agent, {Subject => "block", Incident => $inc_id});
- ticket_state_is($agent, $block_id, 'pending activation');
+ my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
+ $agent->ticket_state_is( $block_id, 'pending activation');
$agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
$agent->form_number(3);
$agent->field( UpdateContent => 'reply' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'pending activation');
+ $agent->ticket_state_is( $block_id, 'pending activation');
$agent->follow_link_ok({ text => 'Activate' }, "activate it");
@@ -97,27 +97,27 @@
$agent->field( UpdateContent => 'activating block' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'active');
+ $agent->ticket_state_is( $block_id, 'active');
}
diag "test activation after reply using Edit page";
{
- my $block_id = create_block($agent, {Subject => "block", Incident => $inc_id});
- ticket_state_is($agent, $block_id, 'pending activation');
+ my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
+ $agent->ticket_state_is( $block_id, 'pending activation');
$agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
$agent->form_number(3);
$agent->field( UpdateContent => 'reply' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'pending activation');
+ $agent->ticket_state_is( $block_id, 'pending activation');
$agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
$agent->form_number(3);
$agent->field(Status => 'open');
$agent->click('SaveChanges');
- ticket_state_is($agent, $block_id, 'active');
+ $agent->ticket_state_is( $block_id, 'active');
}
@@ -127,12 +127,12 @@
skip "RTIR_BlockAproveActionRegexp is defined", 19 if $re;
my $rtname = RT->Config->Get('rtname');
- my $block_id = create_block( $agent, {
+ my $block_id = $agent->create_block( {
Subject => "block",
Incident => $inc_id,
Requestors => 'rt-test at example.com',
} );
- ticket_state_is($agent, $block_id, 'pending activation');
+ $agent->ticket_state_is( $block_id, 'pending activation');
{
my $text = <<EOF;
@@ -145,16 +145,16 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'active');
+ $agent->ticket_state_is( $block_id, 'active');
}
{
- display_ticket($agent, $block_id);
+ $agent->display_ticket( $block_id);
$agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
$agent->form_number(3);
$agent->field( UpdateContent => 'going to remove' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'pending removal');
+ $agent->ticket_state_is( $block_id, 'pending removal');
}
{
@@ -168,7 +168,7 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'removed');
+ $agent->ticket_state_is( $block_id, 'removed');
}
}
@@ -176,12 +176,12 @@
skip "'TestPendingBlock' doesn't match RTIR_BlockAproveActionRegexp", 27
unless $re && 'TestPendingBlock' =~ /$re/;
my $rtname = RT->Config->Get('rtname');
- my $block_id = create_block( $agent, {
+ my $block_id = $agent->create_block( {
Subject => "block",
Incident => $inc_id,
Requestors => 'rt-test at example.com',
} );
- ticket_state_is($agent, $block_id, 'pending activation');
+ $agent->ticket_state_is( $block_id, 'pending activation');
{
my $text = <<EOF;
@@ -194,7 +194,7 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'pending activation');
+ $agent->ticket_state_is( $block_id, 'pending activation');
}
{
@@ -209,16 +209,16 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'active');
+ $agent->ticket_state_is( $block_id, 'active');
}
{
- display_ticket($agent, $block_id);
+ $agent->display_ticket( $block_id);
$agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
$agent->form_number(3);
$agent->field( UpdateContent => 'going to remove' );
$agent->click('SubmitTicket');
- ticket_state_is($agent, $block_id, 'pending removal');
+ $agent->ticket_state_is( $block_id, 'pending removal');
}
{
@@ -232,7 +232,7 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'pending removal');
+ $agent->ticket_state_is( $block_id, 'pending removal');
}
{
@@ -247,7 +247,7 @@
my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
is $status >> 8, 0, "The mail gateway exited ok";
is $id, $block_id, "replied to the ticket";
- ticket_state_is($agent, $block_id, 'removed');
+ $agent->ticket_state_is( $block_id, 'removed');
}
}
Modified: rtir/2.5/trunk/t/009-attachments-processing.t
==============================================================================
--- rtir/2.5/trunk/t/009-attachments-processing.t (original)
+++ rtir/2.5/trunk/t/009-attachments-processing.t Tue Jun 16 23:51:35 2009
@@ -171,8 +171,8 @@
# let's check reply page
{
- my $tid = create_ir($agent, {Subject => "IR #xxx"});
- display_ticket($agent, $tid);
+ my $tid = $agent->create_ir( {Subject => "IR #xxx"});
+ $agent->display_ticket( $tid);
$agent->follow_link_ok({text => 'Reply'}, "go to 'Reply'");
my $content = "this is test";
Modified: rtir/2.5/trunk/t/010-bulk-reject.t
==============================================================================
--- rtir/2.5/trunk/t/010-bulk-reject.t (original)
+++ rtir/2.5/trunk/t/010-bulk-reject.t Tue Jun 16 23:51:35 2009
@@ -16,7 +16,7 @@
# both for IRs that you own and IRs that are unowned. So we make four IRs to work with.
my @irs;
for( my $i = 0; $i < 4; $i++ ) {
- push @irs, create_ir($agent, { Subject => "for bulk reject \#$i" });
+ push @irs, $agent->create_ir( { Subject => "for bulk reject \#$i" });
}
$agent->get_ok('/RTIR/index.html', 'open rtir at glance');
@@ -36,8 +36,8 @@
$agent->tick('SelectedTickets', $irs[0]);
$agent->tick('SelectedTickets', $irs[2]);
$agent->click('BulkReject');
- ok_and_content_like($agent, qr{Ticket $irs[0]: State changed from \w+ to rejected}, 'reject notice');
- ok_and_content_like($agent, qr{Ticket $irs[2]: State changed from \w+ to rejected}, 'reject notice');
+ $agent->ok_and_content_like( qr{Ticket $irs[0]: State changed from \w+ to rejected}, 'reject notice');
+ $agent->ok_and_content_like( qr{Ticket $irs[2]: State changed from \w+ to rejected}, 'reject notice');
$agent->form_number(3);
ok($agent->value('BulkReject'), 'still on reject page');
@@ -54,11 +54,11 @@
$agent->tick('SelectedTickets', $irs[1]);
$agent->tick('SelectedTickets', $irs[3]);
$agent->click('BulkRejectAndReturn');
- ok_and_content_like($agent, qr{Ticket $irs[1]: State changed from new to rejected}, 'reject notice');
- ok_and_content_like($agent, qr{Ticket $irs[3]: State changed from new to rejected}, 'reject notice');
- ok_and_content_like($agent, qr{New unlinked Incident Reports}, 'we are on the main page');
+ $agent->ok_and_content_like( qr{Ticket $irs[1]: State changed from new to rejected}, 'reject notice');
+ $agent->ok_and_content_like( qr{Ticket $irs[3]: State changed from new to rejected}, 'reject notice');
+ $agent->ok_and_content_like( qr{New unlinked Incident Reports}, 'we are on the main page');
}
foreach( @irs ) {
- ticket_state_is( $agent, $_, 'rejected', "Ticket #$_ is rejected" );
+ $agent->ticket_state_is( $_, 'rejected', "Ticket #$_ is rejected" );
}
Modified: rtir/2.5/trunk/t/011-merge.t
==============================================================================
--- rtir/2.5/trunk/t/011-merge.t (original)
+++ rtir/2.5/trunk/t/011-merge.t Tue Jun 16 23:51:35 2009
@@ -10,36 +10,36 @@
diag "simple merge of IRs" if $ENV{'TEST_VERBOSE'};
{
- my $ir1_id = create_ir($agent, {Subject => "ir1 for merging"});
- my $ir2_id = create_ir($agent, {Subject => "ir2 for merging"});
+ my $ir1_id = $agent->create_ir( {Subject => "ir1 for merging"});
+ my $ir2_id = $agent->create_ir( {Subject => "ir2 for merging"});
- display_ticket($agent, $ir2_id);
+ $agent->display_ticket( $ir2_id);
$agent->has_tag('a', 'Merge', 'we have Merge link');
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
$agent->form_number(3);
$agent->field('SelectedTicket', $ir1_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
- display_ticket($agent, $ir1_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
+ $agent->display_ticket( $ir1_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
- display_ticket($agent, $ir2_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
+ $agent->display_ticket( $ir2_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
}
diag "merge an IR into a linked IR, the product should have open state"
if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "base inc for merging"});
- my $ir1_id = create_ir($agent, {Subject => "ir1 for merging", Incident => $inc_id});
- ok_and_content_like($agent, qr{Incident:.*$inc_id}ms, 'Created linked IR');
- ticket_state_is( $agent, $ir1_id, 'open' );
+ my $inc_id = $agent->create_incident( {Subject => "base inc for merging"});
+ my $ir1_id = $agent->create_ir( {Subject => "ir1 for merging", Incident => $inc_id});
+ $agent->ok_and_content_like( qr{Incident:.*$inc_id}ms, 'Created linked IR');
+ $agent->ticket_state_is( $ir1_id, 'open' );
- my $ir2_id = create_ir($agent, {Subject => "ir2 for merging"});
- display_ticket($agent, $ir2_id);
+ my $ir2_id = $agent->create_ir( {Subject => "ir2 for merging"});
+ $agent->display_ticket( $ir2_id);
$agent->has_tag('a', 'Merge', 'we have Merge link');
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
@@ -47,26 +47,26 @@
$agent->form_number(3);
$agent->field('SelectedTicket', $ir1_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
- display_ticket($agent, $ir1_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
+ $agent->display_ticket( $ir1_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
- display_ticket($agent, $ir2_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
+ $agent->display_ticket( $ir2_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
- ticket_state_is( $agent, $ir2_id, 'open' );
+ $agent->ticket_state_is( $ir2_id, 'open' );
}
{ # as previouse but with reversed merge operation
- my $ir1_id = create_ir($agent, {Subject => "ir2 for merging"});
+ my $ir1_id = $agent->create_ir( {Subject => "ir2 for merging"});
- my $inc_id = create_incident($agent, {Subject => "base inc for merging"});
- my $ir2_id = create_ir($agent, {Subject => "ir2 for merging", Incident => $inc_id});
- ok_and_content_like($agent, qr{Incident:.*$inc_id}ms, 'Created linked IR');
- ticket_state_is( $agent, $ir2_id, 'open' );
+ my $inc_id = $agent->create_incident( {Subject => "base inc for merging"});
+ my $ir2_id = $agent->create_ir( {Subject => "ir2 for merging", Incident => $inc_id});
+ $agent->ok_and_content_like( qr{Incident:.*$inc_id}ms, 'Created linked IR');
+ $agent->ticket_state_is( $ir2_id, 'open' );
- display_ticket($agent, $ir2_id);
+ $agent->display_ticket( $ir2_id);
$agent->has_tag('a', 'Merge', 'we have Merge link');
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
@@ -74,24 +74,24 @@
$agent->form_number(3);
$agent->field('SelectedTicket', $ir1_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
- display_ticket($agent, $ir2_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
+ $agent->display_ticket( $ir2_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Second id points to the ticket we merged into');
- display_ticket($agent, $ir1_id);
- ok_and_content_like($agent, qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
- ticket_state_is( $agent, $ir1_id, 'open' );
+ $agent->display_ticket( $ir1_id);
+ $agent->ok_and_content_like( qr{Incident Report #$ir1_id:}, 'Opened the merged ticket');
+ $agent->ticket_state_is( $ir1_id, 'open' );
}
{ # merge two IRs that are linked to different Incidents
- my $inc1_id = create_incident($agent, {Subject => "base inc1 for merging"});
- my $ir1_id = create_ir($agent, {Subject => "ir1 for merging", Incident => $inc1_id});
+ my $inc1_id = $agent->create_incident( {Subject => "base inc1 for merging"});
+ my $ir1_id = $agent->create_ir( {Subject => "ir1 for merging", Incident => $inc1_id});
- my $inc2_id = create_incident($agent, {Subject => "base inc2 for merging"});
- my $ir2_id = create_ir($agent, {Subject => "ir2 for merging", Incident => $inc2_id});
+ my $inc2_id = $agent->create_incident( {Subject => "base inc2 for merging"});
+ my $ir2_id = $agent->create_ir( {Subject => "ir2 for merging", Incident => $inc2_id});
- display_ticket($agent, $ir2_id);
+ $agent->display_ticket( $ir2_id);
$agent->has_tag('a', 'Merge', 'we have Merge link');
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
@@ -99,7 +99,7 @@
$agent->form_number(3);
$agent->field('SelectedTicket', $ir1_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
- ticket_is_linked_to_inc( $agent, $ir1_id, [$inc1_id, $inc2_id] );
+ $agent->ticket_is_linked_to_inc( $ir1_id, [$inc1_id, $inc2_id] );
}
Modified: rtir/2.5/trunk/t/013-custom-field-ip.t
==============================================================================
--- rtir/2.5/trunk/t/013-custom-field-ip.t (original)
+++ rtir/2.5/trunk/t/013-custom-field-ip.t Tue Jun 16 23:51:35 2009
@@ -56,7 +56,7 @@
);
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\Q$val/, "IP on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -84,7 +84,7 @@
);
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\Q$val/, "IP on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -112,7 +112,7 @@
);
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/172\.16\.$i\.0-172\.16\.$i\.1/, "IP range on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -143,7 +143,7 @@
);
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/172\.16\.$i\.0-172\.16\.$i\.1/, "IP range on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -171,7 +171,7 @@
},
);
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
my $field_name = "Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values";
@@ -255,7 +255,7 @@
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' } );
+ my $id = $agent->create_ir( { Subject => "test ip", Content => '1.0.0.0' } );
ok($id, "created a ticket");
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -267,7 +267,7 @@
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' } );
+ $id = $agent->create_ir( { Subject => "test ip", Content => '255.255.255.255' } );
ok($id, "created a ticket");
$ticket = RT::Ticket->new( $RT::SystemUser );
@@ -279,7 +279,7 @@
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' } );
+ $id = $agent->create_ir( { Subject => "test ip", Content => '255.255.255.256' } );
ok($id, "created a ticket");
$ticket = RT::Ticket->new( $RT::SystemUser );
@@ -287,7 +287,7 @@
is($ticket->id, $id, 'loaded ticket');
is($ticket->CustomFieldValues('IP')->Count, 0, "IP wasn't added");
- $id = create_ir( $agent, { Subject => "test ip", Content => '355.255.255.255' } );
+ $id = $agent->create_ir( { Subject => "test ip", Content => '355.255.255.255' } );
ok($id, "created a ticket");
$ticket = RT::Ticket->new( $RT::SystemUser );
@@ -295,7 +295,7 @@
is($ticket->id, $id, 'loaded ticket');
is($ticket->CustomFieldValues('IP')->Count, 0, "IP wasn't added");
- $id = create_ir( $agent, { Subject => "test ip", Content => '8.13.8/8.13.0/1.0' } );
+ $id = $agent->create_ir( { Subject => "test ip", Content => '8.13.8/8.13.0/1.0' } );
ok($id, "created a ticket");
$ticket = RT::Ticket->new( $RT::SystemUser );
@@ -306,7 +306,7 @@
diag "check that IPs in messages don't add duplicates" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test ip",
Content => '192.168.20.2 192.168.20.2 192.168.20.2/32'
} );
@@ -326,7 +326,7 @@
diag "check IPs separated by commas and semicolons" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test ip",
Content => '64.64.64.64, 32.32.32.32; 16.16.16.16.'
} );
@@ -348,7 +348,7 @@
diag "search tickets by IP" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test ip",
Content => '172.16.1/31'
} );
@@ -372,7 +372,7 @@
diag "search tickets by IP range" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test ip",
Content => '172.16.2/26'
} );
@@ -395,9 +395,9 @@
diag "create two tickets with different IPs and check several searches" if $ENV{'TEST_VERBOSE'};
{
- my $id1 = create_ir( $agent, { Subject => "test ip" }, { IP => '192.168.21.10' } );
+ my $id1 = $agent->create_ir( { Subject => "test ip" }, { IP => '192.168.21.10' } );
ok($id1, "created first ticket");
- my $id2 = create_ir( $agent, { Subject => "test ip" }, { IP => '192.168.22.10' } );
+ my $id2 = $agent->create_ir( { Subject => "test ip" }, { IP => '192.168.22.10' } );
ok($id2, "created second ticket");
my $tickets = RT::Tickets->new( $rtir_user );
@@ -473,9 +473,9 @@
diag "create two tickets with different IP ranges and check several searches" if $ENV{'TEST_VERBOSE'};
{
- my $id1 = create_ir( $agent, { Subject => "test ip" }, { IP => '192.168.21.0-192.168.21.127' } );
+ my $id1 = $agent->create_ir( { Subject => "test ip" }, { IP => '192.168.21.0-192.168.21.127' } );
ok($id1, "created first ticket");
- my $id2 = create_ir( $agent, { Subject => "test ip" }, { IP => '192.168.21.128-192.168.21.255' } );
+ my $id2 = $agent->create_ir( { Subject => "test ip" }, { IP => '192.168.21.128-192.168.21.255' } );
ok($id2, "created second ticket");
my $tickets = RT::Tickets->new( $rtir_user );
@@ -571,12 +571,12 @@
{ IP => '172.16.0.2' },
);
- display_ticket($agent, $b1_id);
+ $agent->display_ticket( $b1_id);
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
$agent->form_number(3);
$agent->field('SelectedTicket', $b2_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load( $b1_id );
@@ -611,12 +611,12 @@
{ IP => '172.16.0.1' },
);
- display_ticket($agent, $b1_id);
+ $agent->display_ticket( $b1_id);
$agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
$agent->form_number(3);
$agent->field('SelectedTicket', $b2_id);
$agent->submit;
- ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
+ $agent->ok_and_content_like( qr{Merge Successful}, 'Merge Successful');
my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load( $b1_id );
Modified: rtir/2.5/trunk/t/015-make-clicky.t
==============================================================================
--- rtir/2.5/trunk/t/015-make-clicky.t (original)
+++ rtir/2.5/trunk/t/015-make-clicky.t Tue Jun 16 23:51:35 2009
@@ -14,8 +14,8 @@
diag "clicky ip" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_ir( $agent, { Subject => 'clicky ip', Content => '1.0.0.0' } );
- display_ticket($agent, $id);
+ my $id = $agent->create_ir( { Subject => 'clicky ip', Content => '1.0.0.0' } );
+ $agent->display_ticket( $id);
my @links = $agent->followable_links;
if ( $clicky{'ip'} ) {
my ($lookup_link) = grep lc $_->text eq 'lookup ip', @links;
@@ -25,8 +25,8 @@
ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
}
- $id = create_ir( $agent, { Subject => 'clicky ip', Content => '255.255.255.255' } );
- display_ticket($agent, $id);
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '255.255.255.255' } );
+ $agent->display_ticket( $id);
@links = $agent->followable_links;
if ( $clicky{'ip'} ) {
my ($lookup_link) = grep lc $_->text eq 'lookup ip', @links;
@@ -36,13 +36,13 @@
ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
}
- $id = create_ir( $agent, { Subject => 'clicky ip', Content => '255.255.255.256' } );
- display_ticket($agent, $id);
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '255.255.255.256' } );
+ $agent->display_ticket( $id);
@links = $agent->followable_links;
ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
- $id = create_ir( $agent, { Subject => 'clicky ip', Content => '355.255.255.255' } );
- display_ticket($agent, $id);
+ $id = $agent->create_ir( { Subject => 'clicky ip', Content => '355.255.255.255' } );
+ $agent->display_ticket( $id);
@links = $agent->followable_links;
ok(!grep( lc $_->text eq 'lookup ip', @links ), "not found link");
}
Modified: rtir/2.5/trunk/t/016-date-started.t
==============================================================================
--- rtir/2.5/trunk/t/016-date-started.t (original)
+++ rtir/2.5/trunk/t/016-date-started.t Tue Jun 16 23:51:35 2009
@@ -15,8 +15,8 @@
diag "started date of an investigation" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_investigation($agent, {Subject => "started date"});
- display_ticket($agent, $id);
+ my $id = $agent->create_investigation( {Subject => "started date"});
+ $agent->display_ticket( $id);
my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load( $id );
is($ticket->id, $id, 'loaded ticket');
@@ -25,11 +25,11 @@
diag "started date of an IR" if $ENV{'TEST_VERBOSE'};
{
- my $ir_id = create_ir($agent, {Subject => "started date"});
- display_ticket($agent, $ir_id);
+ my $ir_id = $agent->create_ir( {Subject => "started date"});
+ $agent->display_ticket( $ir_id);
sleep 5;
- my $inc_id = create_incident_for_ir( $agent, $ir_id, {Subject => "started date"} );
+ my $inc_id = $agent->create_incident_for_ir( $ir_id, {Subject => "started date"} );
my $inc = RT::Ticket->new( $RT::SystemUser );
$inc->Load( $inc_id );
is($inc->id, $inc_id, 'loaded inc');
@@ -42,13 +42,13 @@
diag "started date of an IR" if $ENV{'TEST_VERBOSE'};
{
- my $ir_id = create_ir($agent, {Subject => "started date"});
+ my $ir_id = $agent->create_ir( {Subject => "started date"});
my $ir = RT::Ticket->new( $RT::SystemUser );
$ir->Load( $ir_id );
is($ir->id, $ir_id, 'loaded ir');
ok($ir->StartedObj->Unix <= 0, 'started is not set on a new IR');
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->follow_link_ok({text => 'Reply'}, "go to 'Reply'");
is($agent->status, 200, "request successful");
@@ -66,11 +66,11 @@
diag "started date of an IR" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "started date"});
+ my $inc_id = $agent->create_incident( {Subject => "started date"});
sleep 5;
- my $ir_id = create_ir($agent, {Subject => "started date", Incident => $inc_id});
- display_ticket($agent, $ir_id);
+ my $ir_id = $agent->create_ir( {Subject => "started date", Incident => $inc_id});
+ $agent->display_ticket( $ir_id);
my $inc = RT::Ticket->new( $RT::SystemUser );
$inc->Load( $inc_id );
@@ -84,15 +84,15 @@
diag "started date of a block" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident($agent, {Subject => "started date"});
- my $block_id = create_block($agent, {Subject => "started date", Incident => $inc_id});
+ my $inc_id = $agent->create_incident( {Subject => "started date"});
+ my $block_id = $agent->create_block( {Subject => "started date", Incident => $inc_id});
my $block = RT::Ticket->new( $RT::SystemUser );
$block->Load( $block_id );
is($block->id, $block_id, 'loaded block');
ok( $block->StartedObj->Unix <= 0, 'a new block is not active');
- display_ticket($agent, $block_id);
+ $agent->display_ticket( $block_id);
$agent->follow_link_ok({text => 'Activate'}, "activate it");
is($agent->status, 200, "request successful");
Modified: rtir/2.5/trunk/t/019-watchers-on-create.t
==============================================================================
--- rtir/2.5/trunk/t/019-watchers-on-create.t (original)
+++ rtir/2.5/trunk/t/019-watchers-on-create.t Tue Jun 16 23:51:35 2009
@@ -8,7 +8,7 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $ir = create_ir($agent, {Subject => 'IR to test watcher add bug',
+my $ir = $agent->create_ir( {Subject => 'IR to test watcher add bug',
Requestors => 'requestor at example.com', Cc => 'foo at example.com', AdminCc => 'bar at example.com'});
@@ -18,13 +18,13 @@
$agent->content_unlike(qr/permission denied/i, "No permissions problems");
diag("Testing if incident report has all watchers") if($ENV{'TEST_VERBOSE'});
- has_watchers($agent, $ir);
- has_watchers($agent, $ir, 'Cc');
- has_watchers($agent, $ir, 'AdminCc');
+ $agent->has_watchers( $ir);
+ $agent->has_watchers( $ir, 'Cc');
+ $agent->has_watchers( $ir, 'AdminCc');
# Testing creating an incident and investigation from an Incident Report
- my ($ir_inc, $ir_inv) = create_incident_and_investigation($agent,
+ my ($ir_inc, $ir_inv) = $agent->create_incident_and_investigation(
{Subject => "Incident linked with IR $ir to test adding watchers",
InvestigationSubject => "Investigation linked with Incident to test adding watchers",
InvestigationRequestors => 'requestor at example.com',
@@ -39,16 +39,16 @@
$agent->content_unlike(qr/permission denied/i, "No permissions problems");
diag("Testing if investigation from IR has all watchers") if($ENV{'TEST_VERBOSE'});
- has_watchers($agent, $ir_inv);
- has_watchers($agent, $ir_inv, 'Cc');
- has_watchers($agent, $ir_inv, 'AdminCc');
+ $agent->has_watchers( $ir_inv);
+ $agent->has_watchers( $ir_inv, 'Cc');
+ $agent->has_watchers( $ir_inv, 'AdminCc');
}
}
# Testing creating an incident and investigation not from an incident report
-my ($inc, $inv) = create_incident_and_investigation($agent,
+my ($inc, $inv) = $agent->create_incident_and_investigation(
{Subject => "Incident to test adding watchers",
InvestigationSubject => "Investigation linked to Incident to test adding watchers",
InvestigationRequestors => 'requestor at example.com',
@@ -61,15 +61,15 @@
$agent->content_unlike(qr/permission denied/i, "No permissions problems");
diag("Testing if investigation has all watchers") if($ENV{'TEST_VERBOSE'});
- has_watchers($agent, $inv);
- has_watchers($agent, $inv, 'Cc');
- has_watchers($agent, $inv, 'AdminCc');
+ $agent->has_watchers( $inv);
+ $agent->has_watchers( $inv, 'Cc');
+ $agent->has_watchers( $inv, 'AdminCc');
}
# Testing creating an investigation by itself
-my $solo_inv = create_investigation($agent,
+my $solo_inv = $agent->create_investigation(
{Subject => 'Investigation created on its own to test adding watchers',
Requestors => 'requestor at example.com',
Cc => 'foo at example.com',
@@ -81,9 +81,9 @@
$agent->content_unlike(qr/permission denied/i, "No permissions problems");
diag("Testing if solo investigation has all watchers") if($ENV{'TEST_VERBOSE'});
- has_watchers($agent, $solo_inv);
- has_watchers($agent, $solo_inv, 'Cc');
- has_watchers($agent, $solo_inv, 'AdminCc');
+ $agent->has_watchers( $solo_inv);
+ $agent->has_watchers( $solo_inv, 'Cc');
+ $agent->has_watchers( $solo_inv, 'AdminCc');
}
@@ -93,7 +93,7 @@
my $type = shift || 'Correspondents';
local $Test::Builder::Level = $Test::Builder::Level + 1;
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like(
qr{<td class="labeltop">Correspondents:</td>\s*<td class="value">\s*([@\w\.]+)\s*<br />}ms,
Modified: rtir/2.5/trunk/t/019-webui-block-fields.t
==============================================================================
--- rtir/2.5/trunk/t/019-webui-block-fields.t (original)
+++ rtir/2.5/trunk/t/019-webui-block-fields.t Tue Jun 16 23:51:35 2009
@@ -8,10 +8,10 @@
RT::Test->started_ok;
my $agent = default_agent();
-my $incident = create_incident($agent, {Subject => 'Incident to test Block editing'});
-my $block = create_block($agent, {Incident => $incident});
+my $incident = $agent->create_incident( {Subject => 'Incident to test Block editing'});
+my $block = $agent->create_block( {Incident => $incident});
-goto_edit_block($agent, $block);
+$agent->goto_edit_block( $block);
$agent->content_unlike(qr{<option (?:value=.*)?>Use system default\(\)</option>}, "The option 'Use system default()' does not exist.");
@@ -20,7 +20,7 @@
my $agent = shift;
my $id = shift;
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => 'Edit', n => '1'}, "Followed 'Edit' (block) link");
}
Modified: rtir/2.5/trunk/t/020-incident-and-investigation.t
==============================================================================
--- rtir/2.5/trunk/t/020-incident-and-investigation.t (original)
+++ rtir/2.5/trunk/t/020-incident-and-investigation.t Tue Jun 16 23:51:35 2009
@@ -10,8 +10,8 @@
# Tests the creation of inventory-and-investigation from an IR
-my $ir = create_ir($agent, {Subject => 'IR for testing creation of a linked Investigation with no correspondents'});
-display_ticket($agent, $ir);
+my $ir = $agent->create_ir( {Subject => 'IR for testing creation of a linked Investigation with no correspondents'});
+$agent->display_ticket( $ir);
# The following is adapted from create_incident_and_investigation() in t/rtir-test.pl. The reason
@@ -33,7 +33,7 @@
# Okay, enough funny business. Now for some straightforward tests, how it should work
{
- my ($inc_id, $inv_id) = create_incident_and_investigation($agent,
+ my ($inc_id, $inv_id) = $agent->create_incident_and_investigation(
{Subject => 'Incident for testing Incident-and-investigation-from-IR creation',
InvestigationSubject => 'Investigation for testing Incident-and-Investigation-from-IR creation',
InvestigationRequestors => 'foo at example.com'}, {Classification => 'Spam', IP => '172.16.0.1'},
Modified: rtir/2.5/trunk/t/023-gnupg-on-incident.t
==============================================================================
--- rtir/2.5/trunk/t/023-gnupg-on-incident.t (original)
+++ rtir/2.5/trunk/t/023-gnupg-on-incident.t Tue Jun 16 23:51:35 2009
@@ -42,10 +42,10 @@
diag "check that things don't work if there is no key";
{
- my $ir_id = create_ir( $agent, { Subject => 'test', Requestors => 'rt-test at example.com' } );
+ my $ir_id = $agent->create_ir( { Subject => 'test', Requestors => 'rt-test at example.com' } );
ok $ir_id, 'created an IR';
- my $inc_id = create_incident_for_ir( $agent, $ir_id, { Subject => 'test' } );
+ my $inc_id = $agent->create_incident_for_ir( $ir_id, { Subject => 'test' } );
ok $inc_id, 'created an Inc';
RT::Test->clean_caught_mails;
@@ -77,10 +77,10 @@
diag "check that things don't work if there is no key";
{
- my $ir_id = create_ir( $agent, { Subject => 'test', Requestors => 'rt-test at example.com' } );
+ my $ir_id = $agent->create_ir( { Subject => 'test', Requestors => 'rt-test at example.com' } );
ok $ir_id, 'created an IR';
- my $inc_id = create_incident_for_ir( $agent, $ir_id, { Subject => 'test' } );
+ my $inc_id = $agent->create_incident_for_ir( $ir_id, { Subject => 'test' } );
ok $inc_id, 'created an Inc';
RT::Test->clean_caught_mails;
Modified: rtir/2.5/trunk/t/constituency/basics.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/basics.t (original)
+++ rtir/2.5/trunk/t/constituency/basics.t Tue Jun 16 23:51:35 2009
@@ -57,7 +57,7 @@
foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
diag "'$queue' queue" if $ENV{'TEST_VERBOSE'};
- goto_create_rtir_ticket( $agent, $queue );
+ $agent->goto_create_rtir_ticket( $queue );
my $value = $agent->form_number(3)->value("Object-RT::Ticket--CustomField-". $cf->id ."-Values");
is lc $value, lc $default, 'correct value is selected';
@@ -81,7 +81,7 @@
{ Constituency => $val },
);
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\Q$val/, "value on the page" );
DBIx::SearchBuilder::Record::Cachable::FlushCache();
@@ -167,7 +167,7 @@
$agent, { Subject => "test" }, { Constituency => $val }
);
ok( $ir_id, "created IR #$ir_id" );
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->content_like(qr/EDUNET/, "It was created by edunet");
diag "autoreply comes from the EDUNET queue address" if $ENV{'TEST_VERBOSE'};
@@ -206,10 +206,10 @@
diag "move the incident report from EDUNET to GOVNET" if $ENV{'TEST_VERBOSE'};
{
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->follow_link_ok({text => 'Edit'}, "go to Edit page");
$agent->form_number(3);
- ok(set_custom_field( $agent, 'Incident Reports', Constituency => 'GOVNET' ), "fill value in the form");
+ ok($agent->set_custom_field( 'Incident Reports', Constituency => 'GOVNET' ), "fill value in the form");
$agent->click('SaveChanges');
is( $agent->status, 200, "Attempting to edit ticket #$ir_id" );
$agent->content_like( qr/GOVNET/, "value on the page" );
Modified: rtir/2.5/trunk/t/constituency/email.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/email.t (original)
+++ rtir/2.5/trunk/t/constituency/email.t Tue Jun 16 23:51:35 2009
@@ -45,7 +45,7 @@
is $status >> 8, 0, "The mail gateway exited ok";
ok $id, "created ticket $id";
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\Q$val/, "value on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -81,7 +81,7 @@
ok $id, "created ticket $id";
$incident_id = $id if $queue eq 'Incidents';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\Q$val/, "value on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
Modified: rtir/2.5/trunk/t/constituency/email_outgoing.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/email_outgoing.t (original)
+++ rtir/2.5/trunk/t/constituency/email_outgoing.t Tue Jun 16 23:51:35 2009
@@ -76,7 +76,7 @@
ok $ticket->id, 'loaded the ticket';
is $ticket->FirstCustomFieldValue('Constituency'), 'EDUNET', 'correct value';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/\QEDUNET/, "value on the page" );
my @mail = RT::Test->fetch_caught_mails;
@@ -112,7 +112,7 @@
ok $ticket->id, 'loaded the ticket';
is $ticket->FirstCustomFieldValue('Constituency'), 'GOVNET', 'correct value';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/GOVNET/, "value on the page" );
my @mail = RT::Test->fetch_caught_mails;
Modified: rtir/2.5/trunk/t/constituency/propagation-inherit.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/propagation-inherit.t (original)
+++ rtir/2.5/trunk/t/constituency/propagation-inherit.t Tue Jun 16 23:51:35 2009
@@ -30,7 +30,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created IR #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
my $inc_id = create_incident_for_ir(
$agent, $ir_id, { Subject => "test" },
@@ -51,7 +51,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created ticket #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->content_like( qr/GOVNET/, "value on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load( $ir_id );
@@ -116,7 +116,7 @@
{ Constituency => 'GOVNET' },
);
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
DBIx::SearchBuilder::Record::Cachable::FlushCache();
{
@@ -171,7 +171,7 @@
}
diag "edit constituency on the child" if $ENV{'TEST_VERBOSE'};
- display_ticket($agent, $child_id);
+ $agent->display_ticket( $child_id);
$agent->follow_link( text => 'Edit' );
$agent->form_number(3);
$agent->select("Object-RT::Ticket-$child_id-CustomField-". $cf->id ."-Values" => 'EDUNET' );
@@ -195,7 +195,7 @@
}
diag "edit constituency on the incident" if $ENV{'TEST_VERBOSE'};
- display_ticket($agent, $incident_id);
+ $agent->display_ticket( $incident_id);
$agent->follow_link( text => 'Edit' );
$agent->form_number(3);
$agent->select("Object-RT::Ticket-$incident_id-CustomField-". $cf->id ."-Values" => 'GOVNET' );
@@ -254,7 +254,7 @@
}
diag "link the child to parent" if $ENV{'TEST_VERBOSE'};
- LinkChildToIncident( $agent, $child_id, $incident_id );
+ $agent->LinkChildToIncident( $child_id, $incident_id );
diag "check that constituency propagates from parent to child on linking" if $ENV{'TEST_VERBOSE'};
{
Modified: rtir/2.5/trunk/t/constituency/propagation-no.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/propagation-no.t (original)
+++ rtir/2.5/trunk/t/constituency/propagation-no.t Tue Jun 16 23:51:35 2009
@@ -51,7 +51,7 @@
{ Constituency => 'GOVNET' },
);
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->content_like( qr/GOVNET/i, "value on the page" );
DBIx::SearchBuilder::Record::Cachable::FlushCache();
@@ -110,7 +110,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created IR #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
my $inc_id = create_incident_for_ir(
$agent, $ir_id, { Subject => "test" },
@@ -130,7 +130,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created IR #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
my $inc_id = create_incident_for_ir(
$agent, $ir_id, { Subject => "test" }, { Constituency => 'EDUNET' }
@@ -153,7 +153,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok( $inc_id, "created ticket #$inc_id" );
- display_ticket( $agent, $inc_id );
+ $agent->display_ticket( $inc_id );
$agent->content_like( qr/GOVNET/, "value on the page" );
DBIx::SearchBuilder::Record::Cachable::FlushCache();
@@ -169,7 +169,7 @@
my $ir_id = create_ir(
$agent, { Subject => "test", Incident => $inc_id }, { Constituency => 'EDUNET' },
);
- ticket_is_linked_to_inc( $agent, $ir_id => $inc_id );
+ $agent->ticket_is_linked_to_inc( $ir_id => $inc_id );
DBIx::SearchBuilder::Record::Cachable::FlushCache();
{
Modified: rtir/2.5/trunk/t/constituency/propagation-reject.t
==============================================================================
--- rtir/2.5/trunk/t/constituency/propagation-reject.t (original)
+++ rtir/2.5/trunk/t/constituency/propagation-reject.t Tue Jun 16 23:51:35 2009
@@ -30,7 +30,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created IR #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
my $inc_id = create_incident_for_ir(
$agent, $ir_id, { Subject => "test" },
@@ -51,7 +51,7 @@
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
ok $ir_id, "created ticket #$ir_id";
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->content_like( qr/GOVNET/, "value on the page" );
my $ticket = RT::Ticket->new( $RT::SystemUser );
$ticket->Load( $ir_id );
@@ -151,7 +151,7 @@
{ Constituency => 'EDUNET' },
);
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
DBIx::SearchBuilder::Record::Cachable::FlushCache();
{
@@ -167,7 +167,7 @@
is $ticket->FirstCustomFieldValue('Constituency'),
'EDUNET', 'incident still has the same value';
}
- ticket_is_linked_to_inc($agent, $id, $incident_id);
+ $agent->ticket_is_linked_to_inc( $id, $incident_id);
}
}
@@ -179,7 +179,7 @@
my $ir_id = create_ir(
$agent, { Subject => "test" }, { Constituency => 'GOVNET' }
);
- display_ticket($agent, $ir_id);
+ $agent->display_ticket( $ir_id);
$agent->content_like( qr/GOVNET/, "value on the page" );
{
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -195,7 +195,7 @@
my $inc_id = create_incident(
$agent, { Subject => "test" }, { Constituency => 'EDUNET' }
);
- display_ticket($agent, $inc_id);
+ $agent->display_ticket( $inc_id);
$agent->content_like( qr/EDUNET/, "value on the page" );
{
my $ticket = RT::Ticket->new( $RT::SystemUser );
@@ -233,7 +233,7 @@
'GOVNET', 'correct value';
}
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link( text => 'Edit' );
$agent->form_number(3);
$agent->select("Object-RT::Ticket-$id-CustomField-". $cf->id ."-Values" => 'EDUNET' );
@@ -285,7 +285,7 @@
'EDUNET', 'correct value';
}
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link( text => 'Edit' );
my $form = $agent->form_number(3);
ok !eval { $form->value('Constituency') }, 'no constituency hidden field';
@@ -294,7 +294,7 @@
}
# check incident as it's linked now
- display_ticket($agent, $incident_id);
+ $agent->display_ticket( $incident_id);
$agent->follow_link( text => 'Edit' );
my $form = $agent->form_number(3);
ok !eval { $form->value('Constituency') }, 'no constituency hidden field';
Modified: rtir/2.5/trunk/t/incident/abandon.t
==============================================================================
--- rtir/2.5/trunk/t/incident/abandon.t (original)
+++ rtir/2.5/trunk/t/incident/abandon.t Tue Jun 16 23:51:35 2009
@@ -10,50 +10,50 @@
diag "abandon unlinked incident" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_incident( $agent, { Subject => "test" } );
+ my $id = $agent->create_incident( { Subject => "test" } );
$agent->follow_link( text => 'Abandon' );
$agent->content_like(qr/Warning: no recipients!/mi, 'no recipients warning on the page');
$agent->form_number(3);
$agent->click('SubmitTicket');
- is ticket_state($agent, $id), 'abandoned', 'abandoned incident';
+ is $agent->ticket_state( $id), 'abandoned', 'abandoned incident';
}
diag "abandon unlinked incident, but enter a message during abandoning" if $ENV{'TEST_VERBOSE'};
{
- my $id = create_incident( $agent, { Subject => "test" } );
+ my $id = $agent->create_incident( { Subject => "test" } );
$agent->follow_link( text => 'Abandon' );
$agent->content_like(qr/Warning: no recipients!/mi, 'no recipients warning on the page');
$agent->form_number(3);
$agent->field( UpdateContent => 'abandoning' );
$agent->click('SubmitTicket');
- is ticket_state($agent, $id), 'abandoned', 'abandoned incident';
+ is $agent->ticket_state( $id), 'abandoned', 'abandoned incident';
}
diag "simple abandon incident with IR" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident( $agent, { Subject => "test" } );
- my $ir_id = create_ir( $agent, { Subject => "test", Incident => $inc_id } );
+ my $inc_id = $agent->create_incident( { Subject => "test" } );
+ my $ir_id = $agent->create_ir( { Subject => "test", Incident => $inc_id } );
$agent->goto_ticket( $inc_id );
$agent->follow_link( text => 'Abandon' );
$agent->content_unlike(qr/Warning: no recipients!/mi, 'have no "no recipients" warning on the page');
$agent->form_number(3);
$agent->click('SubmitTicket');
- is ticket_state($agent, $inc_id), 'abandoned', 'abandoned incident';
- is ticket_state($agent, $ir_id), 'rejected', 'rejected ir';
+ is $agent->ticket_state( $inc_id), 'abandoned', 'abandoned incident';
+ is $agent->ticket_state( $ir_id), 'rejected', 'rejected ir';
}
diag "abandon incident with resolved IR" if $ENV{'TEST_VERBOSE'};
{
- my $inc_id = create_incident( $agent, { Subject => "test" } );
- my $ir_id = create_ir( $agent, { Subject => "test", Incident => $inc_id } );
+ my $inc_id = $agent->create_incident( { Subject => "test" } );
+ my $ir_id = $agent->create_ir( { Subject => "test", Incident => $inc_id } );
$agent->follow_link( text => 'Quick Resolve' );
- is ticket_state($agent, $ir_id), 'resolved', 'resolved ir';
+ is $agent->ticket_state( $ir_id), 'resolved', 'resolved ir';
$agent->goto_ticket( $inc_id );
$agent->follow_link( text => 'Abandon' );
$agent->form_number(3);
$agent->click('SubmitTicket');
- is ticket_state($agent, $inc_id), 'abandoned', 'abandoned incident';
- is ticket_state($agent, $ir_id), 'resolved', 'resolved ir';
+ is $agent->ticket_state( $inc_id), 'abandoned', 'abandoned incident';
+ is $agent->ticket_state( $ir_id), 'resolved', 'resolved ir';
}
Modified: rtir/2.5/trunk/t/incident/bulk-abandon.t
==============================================================================
--- rtir/2.5/trunk/t/incident/bulk-abandon.t (original)
+++ rtir/2.5/trunk/t/incident/bulk-abandon.t Tue Jun 16 23:51:35 2009
@@ -11,7 +11,7 @@
my @ir_ids;
for(my $i = 1; $i < 5; $i++) {
- push @ir_ids, create_ir($agent, {Subject => "IR number $i for RTIR testing"});
+ push @ir_ids, $agent->create_ir( {Subject => "IR number $i for RTIR testing"});
my $ir_obj = RT::Ticket->new(RT::SystemUser());
my $ir_id = $ir_ids[-1];
@@ -22,52 +22,52 @@
my @incident_ids;
-push @incident_ids, create_incident_for_ir($agent, $ir_ids[0], {Subject => "Incident number 1"}, {Function => "IncidentCoord"});
+push @incident_ids, $agent->create_incident_for_ir( $ir_ids[0], {Subject => "Incident number 1"}, {Function => "IncidentCoord"});
my $inc_obj = RT::Ticket->new(RT::SystemUser());
$inc_obj->Load($incident_ids[0]);
is($inc_obj->Id, $incident_ids[0], "Incident has the right ID");
is($inc_obj->Subject, "Incident number 1", "Incident has the right subject");
-LinkChildToIncident($agent, $ir_ids[1], $incident_ids[0]);
+$agent->LinkChildToIncident( $ir_ids[1], $incident_ids[0]);
-ticket_is_linked_to_inc($agent, $ir_ids[0], [$incident_ids[0]]);
-ticket_is_linked_to_inc($agent, $ir_ids[1], [$incident_ids[0]]);
+$agent->ticket_is_linked_to_inc( $ir_ids[0], [$incident_ids[0]]);
+$agent->ticket_is_linked_to_inc( $ir_ids[1], [$incident_ids[0]]);
-push @incident_ids, create_incident_for_ir($agent, $ir_ids[2], {Subject => 'Incident number 2'}, {Function => 'IncidentCoord'});
+push @incident_ids, $agent->create_incident_for_ir( $ir_ids[2], {Subject => 'Incident number 2'}, {Function => 'IncidentCoord'});
$inc_obj->Load($incident_ids[0]);
is($inc_obj->Id, $incident_ids[0], "Incident has the right ID");
is($inc_obj->Subject, "Incident number 1", "Incident has the right subject");
-LinkChildToIncident($agent, $ir_ids[3], $incident_ids[1]);
+$agent->LinkChildToIncident( $ir_ids[3], $incident_ids[1]);
-ticket_is_linked_to_inc($agent, $ir_ids[2], [$incident_ids[1]]);
-ticket_is_linked_to_inc($agent, $ir_ids[3], [$incident_ids[1]]);
+$agent->ticket_is_linked_to_inc( $ir_ids[2], [$incident_ids[1]]);
+$agent->ticket_is_linked_to_inc( $ir_ids[3], [$incident_ids[1]]);
-resolve_rtir_ticket($agent, $ir_ids[0], 'Incident Report');
+$agent->resolve_rtir_ticket( $ir_ids[0], 'Incident Report');
my @invests;
-push @invests, create_investigation($agent, {Incident => $incident_ids[0], Subject => 'Inv 1 for inc ' . $incident_ids[0]});
-push @invests, create_investigation($agent, {Incident => $incident_ids[0], Subject => 'Inv 2 for inc ' . $incident_ids[0]});
+push @invests, $agent->create_investigation( {Incident => $incident_ids[0], Subject => 'Inv 1 for inc ' . $incident_ids[0]});
+push @invests, $agent->create_investigation( {Incident => $incident_ids[0], Subject => 'Inv 2 for inc ' . $incident_ids[0]});
-push @invests, create_investigation($agent, {Incident => $incident_ids[1], Subject => 'Inv 1 for inc ' . $incident_ids[1]});
-push @invests, create_investigation($agent, {Incident => $incident_ids[0], Subject => 'Inv 2 for inc ' . $incident_ids[1]});
+push @invests, $agent->create_investigation( {Incident => $incident_ids[1], Subject => 'Inv 1 for inc ' . $incident_ids[1]});
+push @invests, $agent->create_investigation( {Incident => $incident_ids[0], Subject => 'Inv 2 for inc ' . $incident_ids[1]});
-resolve_rtir_ticket($agent, $invests[0], 'Investigation');
+$agent->resolve_rtir_ticket( $invests[0], 'Investigation');
-bulk_abandon($agent, @incident_ids);
+$agent->bulk_abandon( @incident_ids);
foreach my $id (@incident_ids) {
- ticket_state_is($agent, $id, 'abandoned', "Incident $id is abandoned");
+ $agent->ticket_state_is( $id, 'abandoned', "Incident $id is abandoned");
}
foreach my $id (@ir_ids ) {
- diag("IR #$id state is " . ticket_state($agent, $id)) if($ENV{'TEST_VERBOSE'});
+ diag("IR #$id state is " . $agent->ticket_state( $id)) if($ENV{'TEST_VERBOSE'});
}
foreach my $id (@invests) {
- diag("IR #$id state is " . ticket_state($agent, $id)) if($ENV{'TEST_VERBOSE'});
+ diag("IR #$id state is " . $agent->ticket_state( $id)) if($ENV{'TEST_VERBOSE'});
}
@@ -100,7 +100,7 @@
foreach my $id (@to_abandon) {
- ok_and_content_like($agent, qr{<li>Ticket $id: State changed from \w+ to abandoned</li>}i, "Incident $id abandoned");
+ $agent->ok_and_content_like( qr{<li>Ticket $id: State changed from \w+ to abandoned</li>}i, "Incident $id abandoned");
}
if ( $agent->content =~ /no incidents/i ) {
@@ -116,7 +116,7 @@
my $id = shift;
my $type = shift || 'Ticket';
- display_ticket($agent, $id);
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Quick Resolve", n => "1"}, "Followed 'Quick Resolve' link");
is($agent->status, 200, "Attempting to resolve $type #$id");
Modified: rtir/2.5/trunk/t/incident/split.t
==============================================================================
--- rtir/2.5/trunk/t/incident/split.t (original)
+++ rtir/2.5/trunk/t/incident/split.t Tue Jun 16 23:51:35 2009
@@ -15,8 +15,8 @@
# regression: split an inc, launch an inv on the new inc => the inv is linked
# to both incidents, which is wrong, should be linked to one only
{
- my $id = create_incident($agent, {Subject => "split incident"});
- display_ticket($agent, $id);
+ my $id = $agent->create_incident( {Subject => "split incident"});
+ $agent->display_ticket( $id);
$agent->follow_link_ok({text => "Split"}, "Followed link");
$agent->form_number(3);
$agent->click('CreateIncident');
@@ -33,7 +33,7 @@
my $inv_id = ($agent->content =~ /.*Ticket (\d+) created.*/i )[0];
ok ($inv_id, "Ticket created successfully: #$inv_id.");
- ticket_is_linked_to_inc($agent, $inv_id, [$new_id]);
- ticket_is_not_linked_to_inc($agent, $inv_id, [$id]);
+ $agent->ticket_is_linked_to_inc( $inv_id, [$new_id]);
+ $agent->ticket_is_not_linked_to_inc( $inv_id, [$id]);
}
Modified: rtir/2.5/trunk/t/mail/skip_notification.t
==============================================================================
--- rtir/2.5/trunk/t/mail/skip_notification.t (original)
+++ rtir/2.5/trunk/t/mail/skip_notification.t Tue Jun 16 23:51:35 2009
@@ -19,7 +19,7 @@
my $email = $rtir_user->EmailAddress;
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test",
Requestors => $email,
} );
@@ -44,7 +44,7 @@
my $email = $rtir_user->EmailAddress;
- my $id = create_ir( $agent, {
+ my $id = $agent->create_ir( {
Subject => "test",
Requestors => $email,
SkipNotification => 'Requestors',
More information about the Rt-commit
mailing list