[Rt-commit] r6237 - in rtir/branches/2.1-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 19 20:33:07 EDT 2006


Author: ruz
Date: Thu Oct 19 20:33:05 2006
New Revision: 6237

Modified:
   rtir/branches/2.1-EXPERIMENTAL/   (props changed)
   rtir/branches/2.1-EXPERIMENTAL/t/001-basic-RTIR.t
   rtir/branches/2.1-EXPERIMENTAL/t/008-workflow-blocks.t
   rtir/branches/2.1-EXPERIMENTAL/t/009-attachments-processing.t
   rtir/branches/2.1-EXPERIMENTAL/t/010-bulk-reject.t
   rtir/branches/2.1-EXPERIMENTAL/t/011-merge.t
   rtir/branches/2.1-EXPERIMENTAL/t/012-split-incident.t
   rtir/branches/2.1-EXPERIMENTAL/t/014-custom-field-constituency.t
   rtir/branches/2.1-EXPERIMENTAL/t/rtir-test.pl

Log:
 r1737 at cubic-pc:  cubic | 2006-10-20 04:44:41 +0400
 * fix tests according to latest changes


Modified: rtir/branches/2.1-EXPERIMENTAL/t/001-basic-RTIR.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/001-basic-RTIR.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/001-basic-RTIR.t	Thu Oct 19 20:33:05 2006
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 22;
+use Test::More tests => 23;
 
 require "t/rtir-test.pl";
 
@@ -33,7 +33,7 @@
 # TODO: make sure all fields are set properly in DB
 
 # create a new incident
-my $second_incident_id = CreateIncident(Subject => "foo Incident", Content => "bar baz quux");
+my $second_incident_id = create_incident( $agent, { Subject => "foo Incident", Content => "bar baz quux" } );
 
 # link our report to that incident
 LinkChildToIncident(id => $report, incident => $second_incident_id);
@@ -55,7 +55,7 @@
     # TODO: Make sure desired incident appears on page
 
     # Choose the incident and submit
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field("SelectedTicket", $incident);
     $agent->click("LinkChild");
 
@@ -66,36 +66,3 @@
     return;
 }
 
-sub CreateIncident {
-    my %args = ( @_ );
-
-    $agent->follow_link_ok({text => "Incidents", n => "1"}, "Followed 'Incidents' link");
-    
-    $agent->follow_link_ok({text => "New Incident", n => "1"}, "Followed 'New Incident' link");
-    
-    # set the form
-    $agent->form_number(2);
-
-    # set the subject
-    $agent->field("Subject", $args{'Subject'});
-
-    # set the content
-    $agent->field("Content", $args{'Content'});
-
-    set_custom_field($agent, Function => "IncidentCoord");
-
-    # Create it!
-    $agent->click("CreateIncident");
-    is ($agent->status, 200, "Attempted to create the Incident");
-
-    # Now see if we succeeded
-    my $content = $agent->content();
-    my $id = -1;
-    if ($content =~ /.*Ticket (\d+) created.*/g) {
-	$id = $1;
-    }
-
-    ok ($id > 1, "Incident $id created successfully.");
-
-    return $id;
-}

Modified: rtir/branches/2.1-EXPERIMENTAL/t/008-workflow-blocks.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/008-workflow-blocks.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/008-workflow-blocks.t	Thu Oct 19 20:33:05 2006
@@ -16,7 +16,7 @@
 # XXX: Comment this tests as we don't allow to create blocks without an incident
 # XXX: we need test for this fact
 #$agent->follow_link_ok({ text => "[Link]" }, "Followed '[Link]' link");
-#$agent->form_number(2);
+#$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');
@@ -37,7 +37,7 @@
 
 foreach my $status( qw(open stalled resolved) ) {
     $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field(Status => $status);
     $agent->click('SaveChanges');
     my $state = $state{ $status };
@@ -46,7 +46,7 @@
 
 
 $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
-$agent->form_number(2);
+$agent->form_number(3);
 $agent->field(Status => 'resolved');
 $agent->click('SaveChanges');
 ticket_state_is($agent, $block_id, 'removed');
@@ -57,7 +57,7 @@
 $agent->has_tag('a', 'Pending Removal', 'we have Pending Removal action tab');
 
 $agent->follow_link_ok({ text => 'Pending Removal' }, "Prepare block for remove");
-$agent->form_number(2);
+$agent->form_number(3);
 $agent->click('SubmitTicket');
 ticket_state_is($agent, $block_id, 'pending removal');
 

Modified: rtir/branches/2.1-EXPERIMENTAL/t/009-attachments-processing.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/009-attachments-processing.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/009-attachments-processing.t	Thu Oct 19 20:33:05 2006
@@ -25,7 +25,7 @@
 {
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachment');
     $agent->field('Attachment', $filename);
     $agent->click('Create');
@@ -57,13 +57,13 @@
     my $fn1 = tempfile($content1);
     my $fn2 = tempfile($content2);
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachments');
     $agent->field('Attachment', $fn1);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     is($agent->value('Subject'), 'ticket with attachments', "subject we put is there");
     $agent->field('Attachment', $fn2);
     $agent->click('Create');
@@ -91,19 +91,19 @@
 {
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachment');
     $agent->field('Attachment', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('DeleteAttachments', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->click('Create');
     is($agent->status, 200, "request successful");
 
@@ -124,12 +124,12 @@
 {
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Attachment', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('CreateIncident'), "we still on the create page");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
@@ -141,12 +141,12 @@
 {
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Attachment', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('Create'), "we still on the create page");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
@@ -159,12 +159,12 @@
 
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Attachment', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('Create'), "we still on the create page");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
@@ -177,13 +177,13 @@
 
     my $content = "this is test";
     my $filename = tempfile($content);
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Attachment', $filename);
     $agent->click('AddAttachment');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('SubmitTicket'), "we still on the create page");
     
     # ok let's try put attachment with empty reply

Modified: rtir/branches/2.1-EXPERIMENTAL/t/010-bulk-reject.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/010-bulk-reject.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/010-bulk-reject.t	Thu Oct 19 20:33:05 2006
@@ -24,19 +24,19 @@
 {
     $agent->follow_link_ok({ text => '[Bulk Reject]' }, "Followed 'bulk reject' link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $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 new to rejected}, 'reject notice');
     ok_and_content_like($agent, qr{Ticket $irs[2]: State changed from new to rejected}, 'reject notice');
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('BulkReject'), 'still on reject page');
 }
 
 {
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok($agent->value('BulkRejectAndReturn'), 'has reject and return button');
 
     $agent->tick('SelectedTickets', $irs[1]);

Modified: rtir/branches/2.1-EXPERIMENTAL/t/011-merge.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/011-merge.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/011-merge.t	Thu Oct 19 20:33:05 2006
@@ -16,7 +16,7 @@
     $agent->has_tag('a', 'Merge', 'we have Merge link');
     $agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('SelectedTicket', $ir1_id);
     $agent->submit;
     ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
@@ -40,7 +40,7 @@
     $agent->has_tag('a', 'Merge', 'we have Merge link');
     $agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('SelectedTicket', $ir1_id);
     $agent->submit;
     ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
@@ -67,7 +67,7 @@
     $agent->has_tag('a', 'Merge', 'we have Merge link');
     $agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('SelectedTicket', $ir1_id);
     $agent->submit;
     ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');
@@ -92,7 +92,7 @@
     $agent->has_tag('a', 'Merge', 'we have Merge link');
     $agent->follow_link_ok({ text => 'Merge' }, "Followed merge link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('SelectedTicket', $ir1_id);
     $agent->submit;
     ok_and_content_like($agent, qr{Merge Successful}, 'Merge Successful');

Modified: rtir/branches/2.1-EXPERIMENTAL/t/012-split-incident.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/012-split-incident.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/012-split-incident.t	Thu Oct 19 20:33:05 2006
@@ -18,14 +18,14 @@
     my $id = create_incident($agent, {Subject => "split incident"});
     display_ticket($agent, $id);
     $agent->follow_link_ok({text => "Split"}, "Followed link");
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->click('CreateIncident');
     is ($agent->status, 200, "Attempted to create the ticket");
     my $new_id = ($agent->content =~ /.*Ticket (\d+) created.*/i )[0];
     ok ($new_id, "Ticket created successfully: #$new_id.");
 
     $agent->follow_link_ok({text => "Launch"}, "Followed link");
-    $agent->form_number(2);
+    $agent->form_number(3);
     $agent->field('Requestors', $rtir_user->EmailAddress);
     $agent->click('Create');
     

Modified: rtir/branches/2.1-EXPERIMENTAL/t/014-custom-field-constituency.t
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/t/014-custom-field-constituency.t	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/t/014-custom-field-constituency.t	Thu Oct 19 20:33:05 2006
@@ -137,7 +137,7 @@
 
     display_ticket($agent, $ir_id);
     $agent->follow_link_ok({text => 'Edit'}, "go to Edit page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok(set_custom_field( $agent, Constituency => 'GOVNET' ), "fill value in the form");
     $agent->click('SaveChanges');
     is( $agent->status, 200, "Attempting to edit ticket #$ir_id" );
@@ -210,7 +210,7 @@
 
     # click [new] near 'incident', set another constituency and create
     $agent->follow_link_ok({text => '[New]'}, "go to 'New Incident' page");
-    $agent->form_number(2);
+    $agent->form_number(3);
     ok(!eval{ set_custom_field( $agent, Constituency => 'EDUNET' ) }, "couldn't change value in the form");
     $agent->click('CreateIncident');
     is ($agent->status, 200, "Attempted to create the ticket");

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	Thu Oct 19 20:33:05 2006
@@ -227,7 +227,7 @@
     # Select the "New" link from the Display page
     $agent->follow_link_ok({text => "[New]"}, "Followed 'New (Incident)' link");
 
-    $agent->form_number(2);
+    $agent->form_number(3);
 
     while (my ($f, $v) = each %$fields) {
         $agent->field($f, $v);


More information about the Rt-commit mailing list