[Rt-commit] r9342 - in rtir/branches/2.3-EXPERIMENTAL: t
ruz at bestpractical.com
ruz at bestpractical.com
Wed Oct 17 17:47:18 EDT 2007
Author: ruz
Date: Wed Oct 17 17:47:15 2007
New Revision: 9342
Modified:
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html
rtir/branches/2.3-EXPERIMENTAL/t/002-test-reject.t
Log:
* make sure all ways to reject an IR leave alone links to incidents
* test coverage for 'Reject', 'Quick Reject' and 'Bulk Reject'
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html Wed Oct 17 17:47:15 2007
@@ -39,14 +39,6 @@
% }
<input type="hidden" name="Action" value="<% $Action || '' %>" />
<input type="hidden" name="TakeOrStealFirst" value="<% $ARGS{TakeOrStealFirst} || '' %>" />
-% if ($Type eq 'Report' and $ARGS{'DefaultStatus'} eq 'rejected') {
-% my $query = "Queue = 'Incidents' AND HasMember = $id";
-% my $incidents = new RT::Tickets($session{'CurrentUser'});
-% $incidents->FromSQL($query);
-% while (my $member = $incidents->Next) {
-<input type="hidden" name="DeleteLink--MemberOf-<%$member->Id%>" />
-% }
-% }
% if ($cannot_sign) {
<& /Elements/GnuPGSignIssues &>
Modified: rtir/branches/2.3-EXPERIMENTAL/t/002-test-reject.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/002-test-reject.t (original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/002-test-reject.t Wed Oct 17 17:47:15 2007
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 51;
+use Test::More tests => 111;
require "t/rtir-test.pl";
@@ -67,3 +67,104 @@
is($ir_obj->Id, $id, "loaded ticket $id OK");
is($ir_obj->Status, 'rejected', "ticket $id is now rejected in DB");
}
+
+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 $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->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' );
+
+ {
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
+ is $tickets->Count, 1, 'the link is still there';
+ }
+
+ # go to incident and check that we still can see the child
+ display_ticket($agent, $inc_id);
+ $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
+ $agent->form_number(3);
+ $agent->tick( States => 'rejected' );
+ $agent->click('RefineStates');
+
+ $agent->has_tag('a', "$id", 'we have link to ticket');
+}
+
+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 $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->follow_link_ok({text => "Quick Reject"}, "Followed 'Reject' link");
+ ticket_state_is( $agent, $id, 'rejected' );
+
+ {
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
+ is $tickets->Count, 1, 'the link is still there';
+ }
+
+ # go to incident and check that we still can see the child
+ display_ticket($agent, $inc_id);
+ $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
+ $agent->form_number(3);
+ $agent->tick( States => 'rejected' );
+ $agent->click('RefineStates');
+
+ $agent->has_tag('a', "$id", 'we have link to ticket');
+}
+
+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 $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->follow_link_ok({text => "Incident Reports"}, "Followed 'Incident Reports' link");
+ $agent->has_tag('a', "$id", 'we have link to ticket');
+ $agent->follow_link_ok({text => "Bulk Reject"}, "Followed 'Bulk Reject' link");
+ $agent->form_number(3);
+ $agent->tick( SelectedTickets => $id );
+ $agent->click('BulkReject');
+
+ ticket_state_is( $agent, $id, 'rejected' );
+
+ {
+ my $tickets = RT::Tickets->new( $RT::SystemUser );
+ $tickets->FromSQL( "id = $id AND MemberOf = $inc_id");
+ is $tickets->Count, 1, 'the link is still there';
+ }
+
+ # go to incident and check that we still can see the child
+ display_ticket($agent, $inc_id);
+ $agent->follow_link_ok({text => "Incident Reports", n => 2}, "Followed 'Incident Reports' link");
+ $agent->form_number(3);
+ $agent->tick( States => 'rejected' );
+ $agent->click('RefineStates');
+
+ $agent->has_tag('a', "$id", 'we have link to ticket');
+}
+
More information about the Rt-commit
mailing list