[Rt-commit] [rtir] 01/01: Failing test for creation of ticket with default Constituency

Kevin Falcone falcone at bestpractical.com
Fri Oct 17 17:08:46 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/constituency-regression-on-email-create
in repository rtir.

commit 9d670bfd561ed41f97552c501ea449cd76dcfeac
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Oct 17 16:58:05 2014 -0400

    Failing test for creation of ticket with default Constituency
    
    RT's e092e23 changed ticket creation to expect that the user creating a
    ticket would be able to load and see all the CFs passed to
    RT::Ticket->Create.  This was done to avoid trying to add Transaction
    CFs to Tickets, but means that RTIR can no longer pass in a default
    value for the Constituency CF during ticket creation by non DutyTeam
    members.
    
    Unfortunately, RTIR needs to do this during RT::Ticket->Create, not
    after, so that Scrips fired on On Create will have access to the
    Constituency (such as all the core Correspondence scrips that change
    $CorrespondAddress based on the value of Constituency).
    
    Previously, no part of RTIR tested ticket creation except as DutyTeam
    members.
---
 t/constituency/email.t | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/t/constituency/email.t b/t/constituency/email.t
index 4eb32e3..f897499 100644
--- a/t/constituency/email.t
+++ b/t/constituency/email.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 67;
+use RT::IR::Test tests => 73;
 
 # Test must be run wtih RT_SiteConfig:
 # Set(@MailPlugins, 'Auth::MailFrom');
@@ -27,6 +27,32 @@ RT::Test->started_ok;
 my $agent = default_agent();
 my $rtir_user = rtir_user();
 
+diag "create a ticket via email from an unprivileged user" if $ENV{'TEST_VERBOSE'};
+{
+    my $i = 0;
+    my $val = RT->Config->Get('RTIR_CustomFieldsDefaults')->{'Constituency'}; # we have one default
+
+    my $text = <<EOF;
+From: someone\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: This is a test of constituency functionality
+
+Foob!
+EOF
+    # Only test IR, random end users don't have permissions to create in other Queues
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Incident Reports');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    ok $id, "created ticket $id";
+
+    $agent->display_ticket( $id);
+    $agent->content_like( qr/\Q$val/, "value on the page" );
+
+    my $ticket = RT::Ticket->new( $RT::SystemUser );
+    $ticket->Load( $id );
+    ok $ticket->id, 'loaded ticket';
+    is $ticket->FirstCustomFieldValue('Constituency'), $val, 'correct value';
+}
+
 diag "create a ticket via gate" if $ENV{'TEST_VERBOSE'};
 {
     my $i = 0;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list