[Rt-commit] r10636 - in rt/branches/3.999-DANGEROUS: . html/REST/1.0/Forms/user t/web

jesse at bestpractical.com jesse at bestpractical.com
Thu Jan 31 20:41:59 EST 2008


Author: jesse
Date: Thu Jan 31 20:41:55 2008
New Revision: 10636

Modified:
   rt/branches/3.999-DANGEROUS/   (props changed)
   rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default
   rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/links
   rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/take
   rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/user/default
   rt/branches/3.999-DANGEROUS/t/web/command_line.t

Log:
 r76033 at pinglin:  jesse | 2008-01-31 20:41:03 -0500
 * REST API runs (and fails many of) its tests


Modified: rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default	(original)
+++ rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/default	Thu Jan 31 20:41:55 2008
@@ -60,12 +60,12 @@
 my ($c, $o, $k, $e) = ("", [], {}, 0);
 my %data   = %$changes;
 my $ticket = RT::Model::Ticket->new() ;
-my @dates  = qw(Created starts Started Due resolved Told LastUpdated);
-my @people = qw(Requestors Cc AdminCc);
-my @create = qw(queue Requestor subject Cc AdminCc Owner Status Priority
+my @dates  = qw(created starts started due resolved told last_updated);
+my @people = qw(requestors cc admin_cc);
+my @create = qw(queue requestor subject cc admin_cc owner status priority
                 initial_priority final_priority time_estimated time_worked
-                time_left starts Started Due Resolved);
-my @simple = qw(subject Status Priority disabled time_estimated time_worked
+                time_left starts started due resolved);
+my @simple = qw(subject status priority disabled time_estimated time_worked
                 time_left initial_priority final_priority);
 my %dates  = map {lc $_ => $_} @dates;
 my %people = map {lc $_ => $_} @people;
@@ -99,23 +99,23 @@
 
         return [
             "# Required: id, Queue",
-            [ qw(id queue Requestor subject Cc AdminCc Owner Status Priority
+            [ qw(id queue requestor subject cc AdminCc Owner status priority
                  initial_priority final_priority time_estimated starts Due Text) ],
             {
                 id               => "ticket/new",
                 queue            => $queue->name,
                 Requestor        => Jifty->web->current_user->name,
                 subject          => "",
-                Cc               => [],
-                AdminCc          => [],
-                Owner            => "",
-                Status           => "new",
-                Priority         => $queue->initial_priority,
+                cc               => [],
+                admin_cc          => [],
+                owner            => "",
+                status           => "new",
+                priority         => $queue->initial_priority,
                 initial_priority  => $queue->initial_priority,
                 final_priority    => $queue->final_priority,
                 time_estimated    => 0,
                 starts           => $starts->iso,
-                Due              => $due->iso,
+                due              => $due->iso,
                 Text             => "",
             },
             0
@@ -186,7 +186,7 @@
     push @data, [ Creator => $ticket->creator_obj->name ]
 	if (!%$fields || exists $fields->{lc 'Creator'});
 
-    foreach (qw(subject Status Priority initial_priority final_priority)) {
+    foreach (qw(subject status priority initial_priority final_priority)) {
 	next unless (!%$fields || (exists $fields->{lc $_}));
         push @data, [$_ => $ticket->$_ ];
     }
@@ -237,7 +237,7 @@
         $n = 1;
 
         if (ref $val eq 'ARRAY') {
-            unless ($key =~ /^(?:Requestors|Cc|AdminCc)$/i) {
+            unless ($key =~ /^(?:requestors|cc|admin_cc)$/i) {
                 $n = 0;
                 $s = "$key may have only one value.";
                 goto SET;

Modified: rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/links
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/links	(original)
+++ rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/links	Thu Jan 31 20:41:55 2008
@@ -63,16 +63,16 @@
 }
 
 my ($c, $o, $k, $e) = ("", [], {}, 0);
-my @fields = qw(DependsOn DependedOnBy RefersTo ReferredToBy Members MemberOf);
+my @fields = qw(depends_on depended_on_by refers_to referred_to_by members member_of);
 my %fields = map { lc $_ => $_ } @fields;
 
 my %lfields = (
-    Members      => { type => 'MemberOf',  Mode => 'base'   },
-    ReferredToBy => { type => 'RefersTo',  Mode => 'base'   },
-    DependedOnBy => { type => 'DependsOn', Mode => 'base'   },
-    MemberOf     => { type => 'MemberOf',  Mode => 'target' },
-    RefersTo     => { type => 'RefersTo',  Mode => 'target' },
-    DependsOn    => { type => 'DependsOn', Mode => 'target' },
+    members      => { type => 'MemberOf',  Mode => 'base'   },
+    referred_to_By => { type => 'RefersTo',  Mode => 'base'   },
+    depended_on_by => { type => 'DependsOn', Mode => 'base'   },
+    member_of     => { type => 'MemberOf',  Mode => 'target' },
+    refers_to     => { type => 'RefersTo',  Mode => 'target' },
+    depends_on    => { type => 'DependsOn', Mode => 'target' },
 );
 
 if ($changes) {

Modified: rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/take
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/take	(original)
+++ rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/ticket/take	Thu Jan 31 20:41:55 2008
@@ -69,67 +69,19 @@
 
 my @comments;
 
-($action = $changes{Action}) =~ s/^(.)(.*)$/\U$1\L$2\E/;
-unless ($action =~ /^(?:Take|Steal|Untake)$/) {
+($action =  $changes{Action}) =~ s/^(.)(.*)$/\U$1\L$2\E/;
+
+unless ($action =~ /^(?:take|steal|untake)$/i) {
     $e = 1;
     $c = "# Invalid action: `$action'.";
     goto OUTPUT;
 }
-
+$action =lc $action;
 my ($status, $msg) = $ticket->$action();
 $c = "# $msg";
 $e = 1  unless $status;
 goto OUTPUT;
 
-#unless ($ticket->current_user_has_right('ModifyTicket') ||
-#        ( ($action eq "Take" || $action eq 'Untake') &&
-#         $ticket->current_user_has_right("TakeTicket")) ||
-#        ($action eq "Steal" &&
-#         $ticket->current_user_has_right("StealTicket")))
-#{
-#    $e = 1;
-#    $c = "# You are not allowed to $action ticket $id.";
-#    goto OUTPUT;
-#}
-
-#if ( keys %changes ) {
-#}
-#else {
-#    # process the form data structure
-#    my ($key, $val);
-#    
-#    foreach $key (keys %data) {
-#        $val = $data{$key};
-#
-#        if ($key =~ /^force$/i) {
-#            if ($val !~ /^(?:0|1)$/) {
-#                push(@comments, "# invalid value for 'force': $val");
-#                goto DONE;
-#            }
-#            my ($ret_id, $msg);
-#
-#            ### take
-#            if ($val == 0) {
-#                ($ret_id, $msg) = $ticket->take;
-#                if (!$ret_id) {
-#                    push(@comments, "# Couldn't take ticket $id: $msg");
-#                    goto DONE;
-#                }
-#                push(@comments, "# Ticket $id taken.");
-#            }
-#            ### steal
-#            else {
-#                ($ret_id, $msg) = $ticket->steal;
-#                if (!$ret_id) {
-#                    push(@comments, "# Couldn't steal ticket $id: $msg");
-#                    goto DONE;
-#                }
-#                push(@comments, "# Ticket $id stolen.");
-#            }
-#        }
-#    }
-#}
-
 OUTPUT:
 return [ $c, $o, $k, $e ];
 </%INIT>

Modified: rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/user/default
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/user/default	(original)
+++ rt/branches/3.999-DANGEROUS/html/REST/1.0/Forms/user/default	Thu Jan 31 20:41:55 2008
@@ -57,9 +57,9 @@
 my ($c, $o, $k, $e) = ("", [], {}, 0);
 my %data = %$changes;
 my $user = RT::Model::User->new() ;
-my @fields = qw(real_name nickname gecos organization Address1 Address2 City
-                State Zip Country HomePhone WorkPhone MobilePhone PagerPhone
-                freeform_contact_info comments Signature lang email_encoding
+my @fields = qw(real_name nickname gecos organization Address1 Address2 city
+                state zip country home_phone work_phone mobile_phone pager_phone
+                freeform_contact_info comments signature lang email_encoding
                 web_encoding ExternalContactInfoId ContactInfoSystem
                 ExternalAuthId auth_system);
 my %fields = map { lc $_ => $_ } @fields;

Modified: rt/branches/3.999-DANGEROUS/t/web/command_line.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/command_line.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/web/command_line.t	Thu Jan 31 20:41:55 2008
@@ -110,7 +110,7 @@
 
     # add attachments to a ticket
     # text attachment
-    check_attachment("$RT::BASE_PATH/lib/t/data/lorem-ipsum");
+    check_attachment("$RT::BASE_PATH/lib/RT.pm");
     # binary attachment
     check_attachment($RT::MasonComponentRoot.'/NoAuth/images/bplogo.gif');
 


More information about the Rt-commit mailing list