[Bps-public-commit] Net-Trac branch, master, updated. 4bd778c7431fcb453a648591bedbdcb7c5f9c80c
? sunnavy
sunnavy at bestpractical.com
Wed May 5 23:49:15 EDT 2010
The branch, master has been updated
via 4bd778c7431fcb453a648591bedbdcb7c5f9c80c (commit)
from 52d44bbfe097a342d1b2898067eb554926af58c1 (commit)
Summary of changes:
lib/Net/Trac/Ticket.pm | 17 ++++++++++++++++-
t/search.t | 4 +---
t/update.t | 10 +++++++---
3 files changed, 24 insertions(+), 7 deletions(-)
- Log -----------------------------------------------------------------
commit 4bd778c7431fcb453a648591bedbdcb7c5f9c80c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu May 6 11:49:11 2010 +0800
stick to the update api: trac doesn't support directly update status and resolution since 0.11.7
diff --git a/lib/Net/Trac/Ticket.pm b/lib/Net/Trac/Ticket.pm
index ec394df..9509086 100644
--- a/lib/Net/Trac/Ticket.pm
+++ b/lib/Net/Trac/Ticket.pm
@@ -339,10 +339,25 @@ sub update {
# Copy over the values we'll be using
my %form = map { "field_".$_ => $args{$_} }
- grep { !/comment|no_auto_status/ } keys %args;
+ grep { !/comment|no_auto_status|status|resolution|owner/ } keys %args;
# Copy over comment too -- it's a pseudo-prop
$form{'comment'} = $args{'comment'};
+ $self->connection->mech->form_number( $form_num );
+
+ if ( $args{'resolution'} || $args{'status'} && $args{'status'} eq 'closed' ) {
+ $form{'action'} = 'resolve';
+ $form{'action_resolve_resolve_resolution'} = $args{'resolution'}
+ if $args{'resolution'};
+ }
+ elsif ( $args{'owner'} || $args{'status'} && $args{'status'} eq 'assigned' ) {
+ $form{'action'} = 'reassign';
+ $form{'action_reassign_reassign_owner'} = $args{'owner'}
+ if $args{'owner'};
+ }
+ elsif ( $args{'status'} && $args{'status'} eq 'reopened' ) {
+ $form{'action'} = 'reopen';
+ }
$self->connection->mech->submit_form(
form_number => $form_num,
diff --git a/t/search.t b/t/search.t
index bcbf6d5..0a53f3d 100644
--- a/t/search.t
+++ b/t/search.t
@@ -4,7 +4,7 @@ use strict;
use Test::More;
unless (`which trac-admin`) { plan skip_all => 'You need trac installed to run the tests'; }
-plan tests => 60;
+plan tests => 58;
use_ok('Net::Trac::Connection');
@@ -52,8 +52,6 @@ ok($ticket->load(3));
like($ticket->state->{'summary'}, qr/Summary moose #3/);
like($ticket->summary, qr/Summary moose #3/, "The summary looks correct");
like($ticket->description, qr/Any::Moose/, "The description looks correct");
-ok($ticket->update( status => 'reopened' ), "Status = reopened");
-is($ticket->status, 'reopened', "Set status");
my $search = Net::Trac::TicketSearch->new( connection => $trac );
isa_ok( $search, 'Net::Trac::TicketSearch' );
diff --git a/t/update.t b/t/update.t
index a85105e..5216161 100644
--- a/t/update.t
+++ b/t/update.t
@@ -4,7 +4,7 @@ use strict;
use Test::More;
unless (`which trac-admin`) { plan skip_all => 'You need trac installed to run the tests'; }
-plan tests => 29;
+plan tests => 32;
use_ok('Net::Trac::Connection');
use_ok('Net::Trac::Ticket');
@@ -49,8 +49,12 @@ isa_ok($search->results->[0], 'Net::Trac::Ticket');
is($search->results->[0]->id, 1, "Got id");
is($search->results->[0]->status, 'closed', "Got status");
sleep(1); # trac can't have two updates within one second
-ok($ticket->update( resolution => 'fixed' ), "resolution = fixed");
+ok($ticket->update( status => 'reopened' ), "status = reopened");
is(@{$ticket->history->entries}, 3, "Got 3 history entries");
-is($ticket->resolution, 'fixed', "Got updated resolution");
+is($ticket->status, 'reopened', "Got updated status");
+sleep(1); # trac can't have two updates within one second
+ok($ticket->update( resolution => 'fixed' ), "resolution = fixed");
+is(@{$ticket->history->entries}, 4, "Got 3 history entries");
+is($ticket->resolution, 'fixed', "Got updated resolution");
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list