[Bps-public-commit] r17504 - in Net-Trac/trunk: . t

trs at bestpractical.com trs at bestpractical.com
Wed Dec 31 18:06:37 EST 2008


Author: trs
Date: Wed Dec 31 18:06:37 2008
New Revision: 17504

Added:
   Net-Trac/trunk/t/update.t
Modified:
   Net-Trac/trunk/   (props changed)
   Net-Trac/trunk/lib/Net/Trac/Ticket.pm

Log:
 r43370 at zot:  tom | 2008-12-31 18:06:27 -0500
 add some basic tests


Modified: Net-Trac/trunk/lib/Net/Trac/Ticket.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Ticket.pm	(original)
+++ Net-Trac/trunk/lib/Net/Trac/Ticket.pm	Wed Dec 31 18:06:37 2008
@@ -167,7 +167,7 @@
             if $args{'owner'} and not $args{'status'};
         
         $args{'status'} = 'accepted'
-            if $args{'owner'} eq $self->connection->user
+            if $args{'owner'} and $args{'owner'} eq $self->connection->user
                and not $args{'status'};
     }
 

Added: Net-Trac/trunk/t/update.t
==============================================================================
--- (empty file)
+++ Net-Trac/trunk/t/update.t	Wed Dec 31 18:06:37 2008
@@ -0,0 +1,52 @@
+use warnings; 
+use strict;
+
+use Test::More qw/no_plan/;
+use_ok('Net::Trac::Connection');
+use_ok('Net::Trac::Ticket');
+use_ok('Net::Trac::TicketSearch');
+require 't/setup_trac.pl';
+
+my $tr = Net::Trac::TestHarness->new();
+ok($tr->start_test_server(), "The server started!");
+
+my $trac = Net::Trac::Connection->new(
+    url      => $tr->url,
+    user     => 'hiro',
+    password => 'yatta'
+);
+
+isa_ok( $trac, "Net::Trac::Connection" );
+is($trac->url, $tr->url);
+my $ticket = Net::Trac::Ticket->new( connection => $trac);
+isa_ok($ticket, 'Net::Trac::Ticket');
+
+can_ok($ticket => '_fetch_new_ticket_metadata');
+ok($ticket->_fetch_new_ticket_metadata);
+can_ok($ticket => 'create');
+ok($ticket->create(summary => 'Summary #1'));
+
+can_ok($ticket, 'load');
+ok($ticket->load(1));
+like($ticket->state->{'summary'}, qr/Summary #1/);
+like($ticket->summary, qr/Summary #1/, "The summary looks correct");
+
+can_ok($ticket => 'update');
+ok($ticket->update( status => 'closed' ), "status = closed");
+is(@{$ticket->history->entries}, 1, "Got one history entry.");
+is($ticket->status, 'closed', "Got updated status");
+
+my $search = Net::Trac::TicketSearch->new( connection => $trac );
+isa_ok( $search, 'Net::Trac::TicketSearch' );
+can_ok( $search => 'query' );
+ok($search->query( id => 1 ));
+is(@{$search->results}, 1, "Got one result");
+isa_ok($search->results->[0], 'Net::Trac::Ticket');
+is($search->results->[0]->id, 1, "Got id");
+is($search->results->[0]->status, 'closed', "Got status");
+
+ok($ticket->update( resolution => 'fixed' ), "resolution = fixed");
+is(@{$ticket->history->entries}, 2, "Got two history entries");
+is($ticket->resolution, 'fixed', "Got updated resolution");
+
+



More information about the Bps-public-commit mailing list