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

ruz at bestpractical.com ruz at bestpractical.com
Mon Aug 6 16:09:33 EDT 2007


Author: ruz
Date: Mon Aug  6 16:09:33 2007
New Revision: 8408

Modified:
   rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t
   rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl

Log:
* add new function to rtir-test.pl
* add more tests fro constituency

Modified: rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/constituency/basics.t	Mon Aug  6 16:09:33 2007
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 154;
+use Test::More tests => 170;
 no warnings 'once';
 
 require "t/rtir-test.pl";
@@ -57,6 +57,19 @@
 my $agent = default_agent();
 my $rtir_user = rtir_user();
 
+diag "check that there is option to set 'no value' on create" if $ENV{'TEST_VERBOSE'};
+{
+    my $default = RT->Config->Get('_RTIR_Constituency_default');
+    foreach my $queue( 'Incidents', 'Incident Reports', 'Investigations', 'Blocks' ) {
+        diag "'$queue' queue" if $ENV{'TEST_VERBOSE'};
+
+        goto_create_rtir_ticket( $agent, $queue );
+
+        my $value = $agent->form_number(3)->value("Object-RT::Ticket--CustomField-". $cf->id ."-Values");
+        is lc $value, lc $default, 'correct value is selected';
+    }
+}
+
 diag "create a ticket via web and set field" if $ENV{'TEST_VERBOSE'};
 {
     my $i = 0;
@@ -126,8 +139,6 @@
     $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'};

Modified: rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/rtir-test.pl	Mon Aug  6 16:09:33 2007
@@ -151,12 +151,9 @@
     return create_rtir_ticket( shift, 'Blocks', @_ );
 }
 
-sub create_rtir_ticket
-{
+sub goto_create_rtir_ticket {
     my $agent = shift;
     my $queue = shift;
-    my $fields = shift || {};
-    my $cfs = shift || {};
 
     my %type = (
         'Incident Reports' => 'Report',
@@ -172,7 +169,16 @@
 
     # set the form
     $agent->form_number(3);
+}
+
+sub create_rtir_ticket
+{
+    my $agent = shift;
+    my $queue = shift;
+    my $fields = shift || {};
+    my $cfs = shift || {};
 
+    goto_create_rtir_ticket($agent, $queue);
 
     $fields->{'Requestors'} ||= $RTIR_TEST_USER if $queue eq 'Investigations';
     while (my ($f, $v) = each %$fields) {
@@ -196,7 +202,7 @@
 
     # Now see if we succeeded
     my $id = get_ticket_id($agent);
-    ok ($id, $type{$queue} . " $id created successfully.");
+    ok ($id, "Created ticket #$id in queue '$queue' successfully.");
 
     return $id;
 }


More information about the Rt-commit mailing list