[Rt-commit] r4915 - rtir/branches/1.9-EXPERIMENTAL/t
glasser at bestpractical.com
glasser at bestpractical.com
Thu Mar 30 16:01:30 EST 2006
Author: glasser
Date: Thu Mar 30 16:01:27 2006
New Revision: 4915
Modified:
rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t
rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl
Log:
extract new-incident-for-IR into helper file
Modified: rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/001-basic-RTIR.t Thu Mar 30 16:01:27 2006
@@ -24,7 +24,8 @@
# Create a new Incident from that report
-my $first_incident_id = NewIncidentFromChild(id => $report);
+my $first_incident_id = create_incident_for_ir($agent, $report, {Subject => "first incident"},
+ {Function => "IncidentCoord"});
# TODO: make sure subject and content come from Report
@@ -40,35 +41,6 @@
# TODO: verify in DB that report has 1 parent, and the right parent
-sub NewIncidentFromChild {
- my %args = ( @_ );
-
- my $id = $args{'id'};
- my $subject = $args{'Subject'};
- my $content = $args{'Content'};
-
- display_ir($agent, $id);
-
- # Select the "New" link from the Display page
- $agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
-
- $agent->form_number(2);
-
- $agent->field("Subject", $subject) if $subject;
- $agent->field("Content", $content) if $content;
-
- set_custom_field($agent, Function => "IncidentCoord");
-
- $agent->click("CreateIncident");
-
- is ($agent->status, 200, "Attempting to create new incident linked to child $id");
-
- ok ($agent->content =~ /.*Ticket (\d+) created in queue*/g, "Incident created from child $id.");
- my $incident_id = $1;
-
- diag("incident ID is $incident_id");
- return $incident_id;
-}
sub LinkChildToIncident {
my %args = ( @_ );
Modified: rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl (original)
+++ rtir/branches/1.9-EXPERIMENTAL/t/rtir-test.pl Thu Mar 30 16:01:27 2006
@@ -140,4 +140,36 @@
return $id;
}
+sub create_incident_for_ir {
+ my $agent = shift;
+ my $ir_id = shift;
+ my $fields = shift || {};
+ my $cfs = shift || {};
+
+ display_ir($agent, $ir_id);
+
+ # Select the "New" link from the Display page
+ $agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
+
+ $agent->form_number(2);
+
+ while (my ($f, $v) = each %$fields) {
+ $agent->field($f, $v);
+ }
+
+ while (my ($f, $v) = each %$cfs) {
+ set_custom_field($agent, $f, $v);
+ }
+
+ $agent->click("CreateIncident");
+
+ is ($agent->status, 200, "Attempting to create new incident linked to child $ir_id");
+
+ 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;
+}
+
1;
More information about the Rt-commit
mailing list