[Rt-commit] r8489 - in rtir/branches/2.3-EXPERIMENTAL: t/constituency

ruz at bestpractical.com ruz at bestpractical.com
Fri Aug 10 01:40:25 EDT 2007


Author: ruz
Date: Fri Aug 10 01:40:24 2007
New Revision: 8489

Modified:
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/email.t
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-reject.t

Log:
* more tests and implementations

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html	Fri Aug 10 01:40:24 2007
@@ -77,6 +77,11 @@
 unless ( $BaseQuery ) {
     $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
     $BaseQuery = join ' AND ', map "( $_ )", $BaseQuery, "MemberOf != $id";
+    if ( RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject' ) {
+        $BaseQuery = join ' AND ', map "( $_ )",
+            $BaseQuery, "CustomField.{_RTIR_Constituency} = '".
+                $IncidentObj->FirstCustomFieldValue('_RTIR_Constituency') ."'"
+    }
 }
 
 my $current_tab = 'RTIR/Incident/LinkChildren.html?'

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/email.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/email.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/email.t	Fri Aug 10 01:40:24 2007
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 180;
+use Test::More tests => 61;
 require "t/rtir-test.pl";
 
 # Test must be run wtih RT_SiteConfig:

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-reject.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-reject.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/propagation-reject.t	Fri Aug 10 01:40:24 2007
@@ -9,7 +9,7 @@
 # XXX: we should use new RT::Test features and start server with
 # option we want.
 if ( RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject' ) {
-    plan tests => 105;
+    plan tests => 127;
 } else {
     plan skip_all => 'constituency propagation algorithm is not "reject"';
 }
@@ -178,3 +178,46 @@
     }
 }
 
+diag "create an IR create an Incident with different constituency"
+    ." and goto [Link] IR, we shouldn't see an IR there"
+        if $ENV{'TEST_VERBOSE'};
+{
+    # an IR
+    my $ir_id = create_ir(
+        $agent, { Subject => "test" }, { Constituency => 'GOVNET' }
+    );
+    display_ticket($agent, $ir_id);
+    $agent->content_like( qr/GOVNET/, "value on the page" );
+    {
+        my $ticket = RT::Ticket->new( $RT::SystemUser );
+        $ticket->Load( $ir_id );
+        ok $ticket->id, 'loaded ticket';
+        is $ticket->QueueObj->Name, 'Incident Reports', 'correct value';
+        is $ticket->FirstCustomFieldValue('_RTIR_Constituency'),
+            'GOVNET', 'correct value';
+        $ticket->Subject("incident report #$ir_id");
+    }
+
+    # an IR
+    my $inc_id = create_incident(
+        $agent, { Subject => "test" }, { Constituency => 'EDUNET' }
+    );
+    display_ticket($agent, $inc_id);
+    $agent->content_like( qr/EDUNET/, "value on the page" );
+    {
+        my $ticket = RT::Ticket->new( $RT::SystemUser );
+        $ticket->Load( $inc_id );
+        ok $ticket->id, 'loaded ticket';
+        is $ticket->QueueObj->Name, 'Incidents', 'correct value';
+        is $ticket->FirstCustomFieldValue('_RTIR_Constituency'),
+            'EDUNET', 'correct value';
+    }
+    $agent->get_ok(
+        $agent->rt_base_url ."/RTIR/Incident/LinkChildren.html?id=$inc_id&"
+        ."Queue=Incident%20Reports&Query=id%3D$ir_id"
+    );
+    $agent->content_unlike(qr/incident report #$ir_id/, 'no IR on the page');
+}
+
+# TODO: decide what to do with Edit page when we're using reject algorithm
+


More information about the Rt-commit mailing list