[Rt-commit] r13218 - in rt/branches/3.8-TESTING: . share/html/REST/1.0/Forms/ticket

sartak at bestpractical.com sartak at bestpractical.com
Thu Jun 12 14:16:05 EDT 2008


Author: sartak
Date: Thu Jun 12 14:16:05 2008
New Revision: 13218

Modified:
   rt/branches/3.8-TESTING/   (props changed)
   rt/branches/3.8-TESTING/share/html/REST/1.0/Forms/ticket/default
   rt/branches/3.8-TESTING/t/web/rest.t

Log:
 r62284 at onn:  sartak | 2008-06-12 14:15:32 -0400
 Fix a forced usage of the old-style CF-foo, and improve t/web/rest's tests to try the new-style CF.{bar}


Modified: rt/branches/3.8-TESTING/share/html/REST/1.0/Forms/ticket/default
==============================================================================
--- rt/branches/3.8-TESTING/share/html/REST/1.0/Forms/ticket/default	(original)
+++ rt/branches/3.8-TESTING/share/html/REST/1.0/Forms/ticket/default	Thu Jun 12 14:16:05 2008
@@ -223,7 +223,10 @@
     # Display custom fields
     my $CustomFields = $ticket->QueueObj->TicketCustomFields();
     while (my $cf = $CustomFields->Next()) {
-	next unless (!%$fields || (exists $fields->{"cf-".lc $cf->Name}));
+        next unless !%$fields
+                 || exists $fields->{"cf.{".lc($cf->Name)."}"}
+                 || exists $fields->{"cf-".lc $cf->Name};
+
         my $vals = $ticket->CustomFieldValues($cf->Id());
         my @out = ();
         while (my $v = $vals->Next()) {

Modified: rt/branches/3.8-TESTING/t/web/rest.t
==============================================================================
--- rt/branches/3.8-TESTING/t/web/rest.t	(original)
+++ rt/branches/3.8-TESTING/t/web/rest.t	Thu Jun 12 14:16:05 2008
@@ -1,18 +1,20 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 13;
+use Test::More tests => 16;
 use RT::Test;
 
 my ($baseurl, $m) = RT::Test->started_ok;
 
-my $cf = RT::Test->load_or_create_custom_field(
-    Name  => 'fu()n:k/',
-    Type  => 'Freeform',
-    Queue => 'General',
-);
-ok($cf->Id, "created a CustomField");
-is($cf->Name, 'fu()n:k/', "correct CF name");
+for my $name ("severity", "fu()n:k/") {
+    my $cf = RT::Test->load_or_create_custom_field(
+        Name  => $name,
+        Type  => 'Freeform',
+        Queue => 'General',
+    );
+    ok($cf->Id, "created a CustomField");
+    is($cf->Name, $name, "correct CF name");
+}
 
 my $queue = RT::Test->load_or_create_queue(Name => 'General');
 ok($queue->Id, "loaded the General queue");
@@ -28,7 +30,8 @@
 shift @lines; # header
 
 # CFs aren't in the default ticket form
-push @lines, "CF-fu()n:k/: maximum";
+push @lines, "CF-fu()n:k/: maximum"; # old style
+push @lines, "CF.{severity}: explosive"; # new style
 
 $text = join "\n", @lines;
 
@@ -54,14 +57,15 @@
     user    => 'root',
     pass    => 'password',
     query   => "id=$id",
-    fields  => "Subject,CF-fu()n:k/,Status",
+    fields  => "Subject,CF-fu()n:k/,CF.{severity},Status",
 ]);
 
 # the fields are interpreted server-side a hash (why?), so we can't depend
 # on order
 for ("id: ticket/1",
      "Subject: REST interface",
-     "CF-fu()n:k/: maximum",
+     "CF.{fu()n:k/}: maximum",
+     "CF.{severity}: explosive",
      "Status: new") {
         $m->content_contains($_);
 }


More information about the Rt-commit mailing list