[Rt-commit] rt branch, 4.0/rest-fix-requestors, created. rt-4.0.8-182-gdc520c9

? sunnavy sunnavy at bestpractical.com
Wed Nov 21 11:09:58 EST 2012


The branch, 4.0/rest-fix-requestors has been created
        at  dc520c9437eb254c878dd3116c9484650a405cb7 (commit)

- Log -----------------------------------------------------------------
commit 33115984d63ae86d709e3f78d8891982dc256825
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 21 22:56:50 2012 +0800

    allow "requestors" because it's a valid field
    
    in 4.0/cli-create-ticket-with-unknown-field, we added extra guard to
    throw errors if there are some fields unknown. we missed "requestors"
    field there, which is actually valid.
    
    see also #21552

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index ca82373..11946f0 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -167,7 +167,7 @@ else {
             elsif (lc $k eq 'text') {
                 $text = delete $data{$k};
             }
-            elsif ( lc $k ne 'id' ) {
+            elsif ( lc $k !~ /^(?:id|requestors)$/ ) {
                 $e = 1;
                 push @$o, $k;
                 push(@comments, "# $k: Unknown field");

commit dc520c9437eb254c878dd3116c9484650a405cb7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Nov 22 00:02:19 2012 +0800

    test for requestors field from rest

diff --git a/t/web/command_line_with_unknown_field.t b/t/web/command_line_with_unknown_field.t
index c2f2724..6afad8a 100644
--- a/t/web/command_line_with_unknown_field.t
+++ b/t/web/command_line_with_unknown_field.t
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use File::Spec ();
 use Test::Expect;
-use RT::Test tests => 17, actual_server => 1;
+use RT::Test tests => 21, actual_server => 1;
 my ($baseurl, $m) = RT::Test->started_ok;
 my $rt_tool_path = "$RT::BinPath/rt";
 
@@ -37,6 +37,15 @@ expect_send("edit ticket/$ticket_id set homer=simpson", 'set unknown field');
 expect_like(qr/homer: Unknown field/, 'homer is unknown field');
 expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
 
+expect_send(
+    q{create -t ticket set requestors='foo at example.com, bar at example.com'},
+    "create ticket with field 'requestors'" );
+expect_like(qr/Ticket \d+ created/, "Created the ticket");
+expect_handle->before() =~ /Ticket (\d+) created/;
+$ticket_id = $1;
+expect_send("show ticket/$ticket_id", 'check requestors');
+expect_like(qr/From: (?:foo\@example\.com, bar\@example\.com|bar\@example\.com, foo\@example\.com)/, "requestors are set correctly");
+
 expect_quit();
 
 # you may encounter warning like Use of uninitialized value $ampm

-----------------------------------------------------------------------


More information about the Rt-commit mailing list