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

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 20 22:39:06 EDT 2006


Author: ruz
Date: Wed Sep 20 22:39:05 2006
New Revision: 6012

Modified:
   rtir/branches/2.1-EXPERIMENTAL/   (props changed)
   rtir/branches/2.1-EXPERIMENTAL/t/014-custom-field-constituency.t

Log:
 r1605 at cubic-pc:  cubic | 2006-09-21 04:41:19 +0400
 * more tests


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	Wed Sep 20 22:39:05 2006
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 97;
+use Test::More tests => 130;
 
 require "t/rtir-test.pl";
 
@@ -38,6 +38,18 @@
     }
 }
 
+my @constituencies;
+diag "fetch list of constituencies and check that groups exist" if $ENV{'TEST_VERBOSE'};
+{
+    @constituencies = map $_->Name, @{ $cf->Values->ItemsArrayRef };
+    ok( scalar @constituencies, "field has some predefined values" );
+    foreach ( @constituencies ) {
+        my $group = RT::Group->new( $RT::SystemUser );
+        $group->LoadUserDefinedGroup( 'DutyTeam '. $_ );
+        ok( $group->id, "loaded group for $_ constituency" );
+    }
+}
+
 my $agent = default_agent();
 my $rtir_user = rtir_user();
 
@@ -120,6 +132,30 @@
     ok( $ticket->id, 'loaded ticket' );
     is( $ticket->QueueObj->Name, 'Incidents', 'correct value' );
     is( $ticket->FirstCustomFieldValue('_RTIR_Constituency'), $val, 'correct value' );
+
+diag "edit constituency on the IR and check that change is cascading" if $ENV{'TEST_VERBOSE'};
+
+    display_ticket($agent, $ir_id);
+    $agent->follow_link_ok({text => 'Edit'}, "go to Edit page");
+    $agent->form_number(2);
+    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" );
+    $agent->content_like( qr/GOVNET/, "value on the page" );
+
+    DBIx::SearchBuilder::Record::Cachable::FlushCache();
+
+    $ticket = RT::Ticket->new( $RT::SystemUser );
+    $ticket->Load( $inc_id );
+    ok( $ticket->id, 'loaded ticket' );
+    is( $ticket->FirstCustomFieldValue('_RTIR_Constituency'), 'GOVNET', 'correct value' );
+
+    $ticket = RT::Ticket->new( $RT::SystemUser );
+    $ticket->Load( $ir_id );
+    ok( $ticket->id, 'loaded ticket' );
+    is( $ticket->FirstCustomFieldValue('_RTIR_Constituency'), 'GOVNET', 'correct value' );
+
+    
 }
 
 diag "create an incident under GOVNET and create a new IR linked to the incident" if $ENV{'TEST_VERBOSE'};


More information about the Rt-commit mailing list