[Bps-public-commit] r12595 - in sd/trunk: . t
jesse at bestpractical.com
jesse at bestpractical.com
Wed May 21 05:05:11 EDT 2008
Author: jesse
Date: Wed May 21 05:05:07 2008
New Revision: 12595
Modified:
sd/trunk/Makefile.PL
sd/trunk/lib/App/SD/Model/Comment.pm
sd/trunk/lib/App/SD/Model/Ticket.pm
sd/trunk/t/sd-comments.t
sd/trunk/t/sd-hm.t
sd/trunk/t/sd-rt-hm.t
Log:
Now passing all tests
Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL (original)
+++ sd/trunk/Makefile.PL Wed May 21 05:05:07 2008
@@ -7,6 +7,7 @@
requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
requires('Clone');
+requires('DateTime');
features(
'RT sync' => [
-default => 1,
Modified: sd/trunk/lib/App/SD/Model/Comment.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Comment.pm (original)
+++ sd/trunk/lib/App/SD/Model/Comment.pm Wed May 21 05:05:07 2008
@@ -3,6 +3,8 @@
package App::SD::Model::Comment;
use base qw/App::SD::Record/;
+use Params::Validate;
+use DateTime;
use constant collection_class => 'App::SD::Collection::Comment';
use constant record_type => 'comment';
@@ -10,8 +12,24 @@
use constant summary_format => '%u %s';
use constant summary_props => qw(content);
+use constant declared_props => qw(date content);
+
+
#has SVK::Model::Ticket;
__PACKAGE__->register_reference( ticket => 'App::SD::Model::Comment');
+sub canonicalize_prop_date {
+ my $self = shift;
+ my %args = validate(@_, { props => 1, errors => 1});
+ my $props = shift;
+ if (!$args{props}->{date} ) {
+ my $date = DateTime->now;
+ $args{props}->{date} = $date->ymd." ".$date->hms;
+ }
+ return 1;
+
+}
+
+
1;
Modified: sd/trunk/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Ticket.pm (original)
+++ sd/trunk/lib/App/SD/Model/Ticket.pm Wed May 21 05:05:07 2008
@@ -7,9 +7,17 @@
use constant collection_class => 'App::SD::Collection::Ticket';
use constant record_type => 'ticket';
+sub summary_props {
+ #my @data = split(/\s+/, shift->handle->config('ticket_summary_props') || 'status summary');
+ my @data = split(/\s+/, 'summary status');
+ return @data;
+
+}
+sub summary_format {
+ #return shift->handle->config('ticket_summary_format')|| '%l %-7.7s %-60.60s';
+ return '%l %s %s';
+}
-use constant summary_format => '%l %-7.7s %-60.60s';
-use constant summary_props => qw(status summary );
sub validate_prop_status {
my ($self, %args) = @_;
Modified: sd/trunk/t/sd-comments.t
==============================================================================
--- sd/trunk/t/sd-comments.t (original)
+++ sd/trunk/t/sd-comments.t Wed May 21 05:05:07 2008
@@ -2,35 +2,68 @@
use strict;
-use Prophet::Test tests => 9;
+use Prophet::Test tests => 8;
use App::SD::Test;
no warnings 'once';
BEGIN {
require File::Temp;
- $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
+ $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
+ = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
warn $ENV{'PROPHET_REPO'};
}
+
# create from sd and push
-my $yatta_uuid;
-run_output_matches( 'sd', [ 'ticket',
- 'create', '--summary', 'YATTA', '--status', 'new' ],
- [qr/Created ticket (.*)(?{ $yatta_uuid = $1 })/]
-);
-my $yatta_luid;
-run_output_matches( 'sd', [ 'ticket',
- 'list', '--regex', '.' ],
- [qr/^(.*?)(?{$yatta_luid = $1}) YATTA new/]
-);
+my ( $yatta_luid, $yatta_uuid )
+ = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
-my ($comment_id, $comment_uuid) = create_ticket_comment_ok( qw/--uuid/, $yatta_uuid, '--content', "'This is a test'");
+my ( $comment_id, $comment_uuid )
+ = create_ticket_comment_ok( qw/--uuid/, $yatta_uuid, '--content',
+ "'This is a test'" );
ok($comment_uuid);
-run_output_matches('sd', [qw/ticket comments --uuid/, $yatta_uuid], [qr/^comment id: $comment_uuid/,'Content:',"'This is a test'"], [], "Found the comment");
+run_output_matches(
+ 'sd',
+ [ qw/ticket comments --uuid/, $yatta_uuid ],
+ [ qr/^id: \d+ \($comment_uuid\)/, qr/^date: /, "'This is a test'" ],
+ [], "Found the comment"
+);
-run_output_matches('sd', [qw/ticket comment show --uuid/, $comment_uuid], [qr/id: (\d+) \($comment_uuid\)/, qr/This is a test/, "ticket: $yatta_uuid"], [], "Found the comment");
-run_output_matches('sd', [qw/ticket comment update --uuid/, $comment_uuid, qw/--content/, "I hate you" ], [qr/comment $comment_uuid updated/], [], "updated the comment");
-run_output_matches('sd', [qw/ticket comment show --uuid/, $comment_uuid], [qr/id: (\d+) \($comment_uuid\)/, qr/I hate you/, "ticket: $yatta_uuid"], [], "Found the comment new version");
+run_output_matches(
+ 'sd',
+ [ qw/ticket comment show --uuid/, $comment_uuid ],
+ [ qr/id: (\d+) \($comment_uuid\)/,
+ qr/date: /i,
+ qr/This is a test/,
+ "ticket: $yatta_uuid"
+ ],
+ [],
+ "Found the comment"
+);
+run_output_matches(
+ 'sd',
+ [ qw/ticket comment update --uuid/, $comment_uuid,
+ qw/--content/, "I hate you"
+ ],
+ [qr/comment $comment_uuid updated/],
+ [],
+ "updated the comment"
+);
+run_output_matches(
+ 'sd',
+ [ qw/ticket comment show --uuid/, $comment_uuid ],
+ [ qr/id: (\d+) \($comment_uuid\)/,
+ qr/date: /i,
+ qr/I hate you/, "ticket: $yatta_uuid" ],
+ [],
+ "Found the comment new version"
+);
-run_output_matches('sd', [qw/ticket comment list --uuid/, $yatta_uuid], [qr/$comment_uuid/], [], "Found the comment when we tried to search for all comments on a ticket by the ticket's uuid");
+run_output_matches(
+ 'sd',
+ [ qw/ticket comment list --uuid/, $yatta_uuid ],
+ [qr/$comment_uuid/],
+ [],
+ "Found the comment when we tried to search for all comments on a ticket by the ticket's uuid"
+);
Modified: sd/trunk/t/sd-hm.t
==============================================================================
--- sd/trunk/t/sd-hm.t (original)
+++ sd/trunk/t/sd-hm.t Wed May 21 05:05:07 2008
@@ -52,7 +52,7 @@
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
-run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr"$flyman_uuid Crash Man (.*)"] );
+run_output_matches_unordered( 'sd', [ 'ticket', 'list', '--regex', '.' ], ["$flyman_uuid Crash Man (no status)"] );
( $ret, $out, $err ) = run_script( 'sd', [ 'ticket', 'show', '--id', $flyman_uuid ] );
@@ -65,7 +65,7 @@
diag $yatta_uuid;
-run_output_matches(
+run_output_matches_unordered(
'sd',
[ 'ticket', 'list', '--regex', '.' ],
[ sort
@@ -81,7 +81,7 @@
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from',$sd_hm_url ] );
-run_output_matches(
+run_output_matches_unordered(
'sd',
[ 'ticket', 'list', '--regex', '.' ],
[ sort "$yatta_id YATTA new", "$flyman_id Crash Man (no status)" ]
@@ -91,7 +91,7 @@
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
-run_output_matches(
+run_output_matches_unordered(
'sd',
[ 'ticket', 'list', '--regex', '.' ],
[ sort "$yatta_id KILL new", "$flyman_id Crash Man (no status)" ]
Modified: sd/trunk/t/sd-rt-hm.t
==============================================================================
--- sd/trunk/t/sd-rt-hm.t (original)
+++ sd/trunk/t/sd-rt-hm.t Wed May 21 05:05:07 2008
@@ -96,7 +96,6 @@
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
diag($err) if ($err);
run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $bob_flyman_id = $1 }) Fly Man new/] );
- warn `sd ticket list --regex .`;
diag("Bob pulling from alice");
( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', repo_uri_for('alice') ] );
More information about the Bps-public-commit
mailing list