[Bps-public-commit] r12487 - in sd/branches/usability: . lib/App/SD t

jesse at bestpractical.com jesse at bestpractical.com
Sat May 17 09:10:32 EDT 2008


Author: jesse
Date: Sat May 17 09:10:32 2008
New Revision: 12487

Added:
   sd/branches/usability/lib/App/SD/Test.pm
Modified:
   sd/branches/usability/   (props changed)
   sd/branches/usability/Makefile.PL
   sd/branches/usability/lib/App/SD/Model/Ticket.pm
   sd/branches/usability/t/01-dependencies.t
   sd/branches/usability/t/attachment-content.t
   sd/branches/usability/t/sd-attachments.t
   sd/branches/usability/t/sd-comments.t
   sd/branches/usability/t/sd-hm.t
   sd/branches/usability/t/sd-rt-hm.t
   sd/branches/usability/t/sd-rt.t
   sd/branches/usability/t/sd-validation.t

Log:
 r31198 at dhcp113:  jesse | 2008-05-17 21:38:08 +0900
 * checkpoint the uuid/luid cleanup


Modified: sd/branches/usability/Makefile.PL
==============================================================================
--- sd/branches/usability/Makefile.PL	(original)
+++ sd/branches/usability/Makefile.PL	Sat May 17 09:10:32 2008
@@ -6,11 +6,11 @@
 version_from('lib/App/SD.pm');
 
 requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
-
+requires('Clone');
 features(
     'RT sync' => [
         -default => 1,
-        'RT::Client::Rest' => 0, # RT::Client::REST::Ticket
+        'RT::Client::REST' => 0, # RT::Client::REST::Ticket
         'DateTime::Format::HTTP' => 0,
 
     ],
@@ -18,7 +18,7 @@
     'Hiveminder sync' => [
         -default => 1,
         'Net::Jifty' => 0,
-        recommends('Jifty'),
+        'Jifty' => 0,
     ],
 );
 auto_install();

Modified: sd/branches/usability/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/branches/usability/lib/App/SD/Model/Ticket.pm	(original)
+++ sd/branches/usability/lib/App/SD/Model/Ticket.pm	Sat May 17 09:10:32 2008
@@ -8,7 +8,7 @@
 use constant record_type => 'ticket';
 
 
-use constant summary_format => '%u %s %s';
+use constant summary_format => '%l %s %s';
 use constant summary_props => qw(summary status);
 
 sub validate_prop_status {

Added: sd/branches/usability/lib/App/SD/Test.pm
==============================================================================
--- (empty file)
+++ sd/branches/usability/lib/App/SD/Test.pm	Sat May 17 09:10:32 2008
@@ -0,0 +1,52 @@
+package App::SD::Test;
+
+use warnings;
+use strict;
+
+require Prophet::Test;
+use base qw/Exporter/;
+our @EXPORT = qw(create_ticket_ok create_ticket_comment_ok get_uuid_for_luid get_luid_for_uuid);
+
+sub create_ticket_ok {
+    my @args = (@_);
+    my ( $uuid, $luid );
+    Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'create', @args ],
+        [qr/Created ticket (.*?)(?{ $luid = $1})\s+\((.*)(?{ $uuid = $2 })\)/]
+    );
+
+    return ( $luid, $uuid );
+}
+
+sub create_ticket_comment_ok {
+    my @args = (@_);
+    my ( $uuid, $luid );
+    Prophet::Test::run_output_matches(
+        'sd',
+        [ 'ticket', 'comment', 'create', @args ],
+        [qr/Created comment (.*?)(?{ $luid = $1})\s+\((.*)(?{ $uuid = $2 })\)/]
+    );
+
+    return ( $luid, $uuid );
+}
+
+
+
+sub get_uuid_for_luid {
+        my $luid = shift;
+    my ($ok, $out, $err) =  Prophet::Test::run_script( 'sd', [ 'ticket', 'show', '--id', $luid ]);
+    if ($out =~ /^id: \d+ \((.*)\)/) {
+            return $1;
+    }
+    return undef;
+}
+
+
+sub get_luid_for_uuid {
+        my $uuid = shift;
+    my ($ok, $out, $err) =  Prophet::Test::run_script( 'sd', [ 'ticket', 'show', '--id', $uuid ]);
+    if ($out =~ /^id: (\d+)/) {
+            return $1;
+    }
+    return undef;
+}
+

Modified: sd/branches/usability/t/01-dependencies.t
==============================================================================
--- sd/branches/usability/t/01-dependencies.t	(original)
+++ sd/branches/usability/t/01-dependencies.t	Sat May 17 09:10:32 2008
@@ -49,7 +49,7 @@
     ok( open( MAKEFILE, "Makefile.PL" ), "Opened Makefile" );
     my $data = <MAKEFILE>;
     close(FILE);
-    while ( $data =~ /^\s*?(?:requires|recommends).*?([\w:]+)'(?:\s*=>\s*['"]?([\d\.]+)['"]?)?.*?(?:#(.*))?$/gm ) {
+    while ( $data =~ /^\s*?(?:requires|recommends)?.*?([\w:]+)'(?:\s*=>\s*['"]?([\d\.]+)['"]?)?.*?(?:#(.*))?$/gm ) {
         $required{$1} = $2;
         if ( defined $3 and length $3 ) {
             $required{$_} = undef for split ' ', $3;

Modified: sd/branches/usability/t/attachment-content.t
==============================================================================
--- sd/branches/usability/t/attachment-content.t	(original)
+++ sd/branches/usability/t/attachment-content.t	Sat May 17 09:10:32 2008
@@ -3,7 +3,7 @@
 use strict;
 
 use Prophet::Test tests => 10;
-
+use App::SD::Test;
 use File::Temp qw/tempdir/;
 use Path::Class;
 
@@ -23,25 +23,41 @@
     warn "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
 }
 # 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_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new"]
+    [ qr/(\d+) YATTA new/]
+   
 );
 
 my $attachment_uuid;
-run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--file', $file], [qr/Created attachment (.*?)(?{ $attachment_uuid = $1})$/], [], "Added a attachment");
+my $attachment_id;
+run_output_matches(
+    'sd',
+    [ qw/ticket attachment create --uuid/, $yatta_uuid, '--file', $file ],
+    [   qr/Created attachment (\d+)(?{$attachment_id = $1}) \((.*?)(?{ $attachment_uuid = $2})\)$/
+    ],
+    [],
+    "Added a attachment"
+);
 ok($attachment_uuid);
 
-run_output_matches('sd', [qw/ticket attachment list --uuid/, $yatta_uuid], [$attachment_uuid . " paper_order.doc text/plain"],
-    , [], "Found the attachment, but doesn't show the content");
+run_output_matches(
+    'sd',
+    [ qw/ticket attachment list --uuid/, $yatta_uuid ],
+    [ $attachment_uuid . " paper_order.doc text/plain" ],
+    ,
+    [],
+    "Found the attachment, but doesn't show the content"
+);
 
-run_output_matches('sd', [qw/attachment content --uuid/, $attachment_uuid], ['5 tonnes of hard white'],[], "We got the content");
+run_output_matches(
+    'sd',
+    [ qw/attachment content --uuid/, $attachment_uuid ],
+    ['5 tonnes of hard white'],
+    [], "We got the content"
+);
 
 
 diag("Add a binary attachment");
@@ -49,10 +65,10 @@
 my $image_attach;
 my $image_file = 't/data/bplogo.gif';
 
-run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--file', $image_file], [qr/Created attachment (.*?)(?{ $image_attach = $1})$/], [], "Added a attachment");
+run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--file', $image_file], [qr/Created attachment (\d+)(?{ $image_attach = $1})/], [], "Added a attachment");
 
 my $image_data = file($image_file)->slurp;
-my ($ret, $stdout, $stderr) = run_script('sd', [qw/attachment content --uuid/, $image_attach]);
+my ($ret, $stdout, $stderr) = run_script('sd', [qw/attachment content --id/, $image_attach]);
 ok($ret, "Ran the script ok");
 is($stdout, $image_data, "We roundtripped some binary");
 is($stderr, '');

Modified: sd/branches/usability/t/sd-attachments.t
==============================================================================
--- sd/branches/usability/t/sd-attachments.t	(original)
+++ sd/branches/usability/t/sd-attachments.t	Sat May 17 09:10:32 2008
@@ -3,7 +3,7 @@
 use strict;
 
 use Prophet::Test tests => 9;
-
+use App::SD::Test;
 no warnings 'once';
 
 BEGIN {
@@ -12,27 +12,26 @@
     warn "export SD_REPO=".$ENV{'PROPHET_REPO'} ."\n";
 }
 # 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_id, $yatta_uuid) =  create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new"]
+    [ qr/$yatta_id YATTA new/]
 );
 
+my $attachment_id;
 my $attachment_uuid;
-run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--content', 'stub', '--name', "paper_order.doc"], [qr/Created attachment (.*?)(?{ $attachment_uuid = $1})$/], [], "Added a attachment");
-ok($attachment_uuid);
+run_output_matches('sd', [qw/ticket attachment create --id/, $yatta_uuid, '--content', 'stub', '--name', "paper_order.doc"], [qr/Created attachment (\d+)(?{ $attachment_id = $1}) \((.*)(?{ $attachment_uuid = $2})\)/], [], "Added a attachment");
+ok($attachment_id);
 
-run_output_matches('sd', [qw/ticket attachment list --uuid/, $yatta_uuid], [$attachment_uuid .  ' paper_order.doc text/plain',], [], "Found the attachment");
+run_output_matches('sd', [qw/ticket attachment list --id/, $yatta_uuid], [qr/\d+ paper_order.doc text\/plain/,], [], "Found the attachment");
 
 run_output_matches(
     'sd',
-    [ qw/ticket attachment show --uuid/, $attachment_uuid ],
-    [   "id: $attachment_uuid",
+    [ qw/ticket attachment show --id/, $attachment_id ],
+    [ 
+    
+        qr/id: $attachment_id \($attachment_uuid\)/, 
         "content_type: text/plain",
         qr/paper_order.doc/,
         "content: stub",
@@ -43,7 +42,7 @@
 );
 run_output_matches(
     'sd',
-    [   qw/ticket attachment update --uuid/, $attachment_uuid,
+    [   qw/ticket attachment update --id/, $attachment_uuid,
         qw/--name/,                          "plague_recipe.doc"
     ],
     [qr/attachment $attachment_uuid updated/],
@@ -52,8 +51,9 @@
 );
 run_output_matches(
     'sd',
-    [ qw/ticket attachment show --uuid/, $attachment_uuid ],
-    [   "id: $attachment_uuid",
+    [ qw/ticket attachment show --id/, $attachment_uuid ],
+    [  
+        qr/id: (\d+) \($attachment_uuid\)/, 
         "content_type: text/plain",
         qr/plague_recipe.doc/,
         "content: stub",
@@ -65,8 +65,8 @@
 
 run_output_matches(
     'sd',
-    [ qw/ticket attachment list --uuid/, $yatta_uuid ],
-    [qr/$attachment_uuid/],
+    [ qw/ticket attachment list --id/, $yatta_uuid ],
+    [qr/plague_recipe/],
     [],
     "Found the attachment when we tried to search for all attachments on a ticket by the ticket's uuid"
 );

Modified: sd/branches/usability/t/sd-comments.t
==============================================================================
--- sd/branches/usability/t/sd-comments.t	(original)
+++ sd/branches/usability/t/sd-comments.t	Sat May 17 09:10:32 2008
@@ -3,7 +3,7 @@
 use strict;
 
 use Prophet::Test tests => 9;
-
+use App::SD::Test;
 no warnings 'once';
 
 BEGIN {
@@ -18,19 +18,19 @@
     [qr/Created ticket (.*)(?{ $yatta_uuid = $1 })/]
 );
 
+my $yatta_luid;
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new"]
+    [qr/^(.*?)(?{$yatta_luid = $1}) YATTA new/]
 );
 
-my $comment_uuid;
-run_output_matches('sd', [qw/ticket comment create --uuid/, $yatta_uuid, '--content', "'This is a test'"], [qr/Created comment (.*?)(?{ $comment_uuid = $1})$/], [], "Added a comment");
+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 comment show --uuid/, $comment_uuid], ["id: $comment_uuid", qr/This is a test/, "ticket: $yatta_uuid"], [], "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], ["id: $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/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");

Modified: sd/branches/usability/t/sd-hm.t
==============================================================================
--- sd/branches/usability/t/sd-hm.t	(original)
+++ sd/branches/usability/t/sd-hm.t	Sat May 17 09:10:32 2008
@@ -2,7 +2,7 @@
 use warnings;
 use strict;
 use Prophet::Test;
-
+use App::SD::Test;
 use Test::More;
 
 BEGIN {
@@ -42,11 +42,10 @@
 my ( $ret, $out, $err );
 
 my $sd_hm_url = "hm:$URL";
-warn $URL;
 eval { ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] ) };
 diag $err;
 
-my ( $yatta_uuid, $flyman_uuid );
+my ($flyman_uuid, $flyman_id );
 run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/(.*?)(?{ $flyman_uuid = $1 }) Fly Man (.*)/] );
 
 $task->set_summary('Crash Man');
@@ -55,21 +54,24 @@
 
 run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr"$flyman_uuid Crash Man (.*)"] );
 
-( $ret, $out, $err ) = run_script( 'sd', [ 'ticket', 'show', '--uuid', $flyman_uuid ] );
 
-run_output_matches(
-    'sd',
-    [ 'ticket', 'create', '--summary', 'YATTA', '--status', 'new' ],
-    [qr/Created ticket (.*)(?{ $yatta_uuid = $1 })/]
-);
+( $ret, $out, $err ) = run_script( 'sd', [ 'ticket', 'show', '--id', $flyman_uuid ] );
+if ($out =~ /^id: (\d+) /) {
+    $flyman_id = $1;
+}
+
+my ($yatta_id, $yatta_uuid) = create_ticket_ok( '--summary', 'YATTA', '--status', 'new' );
 
 diag $yatta_uuid;
 
+
 run_output_matches(
     'sd',
     [ 'ticket', 'list', '--regex', '.' ],
-    [   sort "$yatta_uuid YATTA new",
-        "$flyman_uuid Crash Man (no status)",    # XXX: or whatever status captured previously
+    [ sort  
+        "$yatta_id YATTA new",
+        "$flyman_id Crash Man (no status)"
+    
     ]
 );
 
@@ -82,7 +84,7 @@
 run_output_matches(
     'sd',
     [ 'ticket',                     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new", "$flyman_uuid Crash Man (no status)", ]
+    [ sort "$yatta_id YATTA new", "$flyman_id Crash Man (no status)" ]
 );
 
 $task->set_summary('KILL');
@@ -92,5 +94,5 @@
 run_output_matches(
     'sd',
     [ 'ticket',                    'list', '--regex', '.' ],
-    [ sort "$yatta_uuid KILL new", "$flyman_uuid Crash Man (no status)", ]
+    [ sort "$yatta_id KILL new", "$flyman_id Crash Man (no status)" ]
 );

Modified: sd/branches/usability/t/sd-rt-hm.t
==============================================================================
--- sd/branches/usability/t/sd-rt-hm.t	(original)
+++ sd/branches/usability/t/sd-rt-hm.t	Sat May 17 09:10:32 2008
@@ -7,6 +7,7 @@
 
 # setup for rt
 use Prophet::Test;
+use App::SD::Test;
 
 BEGIN {
     unless (eval 'use RT::Test (); 1') {
@@ -75,7 +76,7 @@
     description => '',
 );
 
-my ( $yatta_uuid, $flyman_uuid );
+my ( $bob_yatta_id, $bob_flyman_id, $flyman_uuid, $yatta_uuid, $alice_yatta_id, $alice_flyman_id );
 my ( $ret, $out, $err );
 
 # now the tests, bob syncs with rt, alice syncs with hm
@@ -83,7 +84,8 @@
     local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
     ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_hm_url ] );
     diag($err) if ($err);
-    run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/(.*?)(?{ $yatta_uuid = $1 }) YATTA .*/] );
+    run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/^(.*?)(?{ $alice_yatta_id = $1 }) YATTA .*/] );
+    $yatta_uuid = get_uuid_for_luid($alice_yatta_id);
 };
 
 as_bob {
@@ -93,14 +95,18 @@
     diag("Bob pulling from RT");
     ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
     diag($err) if ($err);
-    run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], [qr/(.*?)(?{ $flyman_uuid = $1 }) Fly Man new/] );
-
+    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') ] );
+
+    $flyman_uuid = get_uuid_for_luid($bob_flyman_id);
+    my $bob_yatta_id = get_luid_for_uuid($yatta_uuid);
+
     run_output_matches(
         'sd',
         [ 'ticket',                             'list', '--regex', '.' ],
-        [ sort "$yatta_uuid YATTA (no status)", "$flyman_uuid Fly Man new", ]
+        [ reverse sort "$bob_yatta_id YATTA (no status)", "$bob_flyman_id Fly Man new" ]
     );
 
 
@@ -114,10 +120,14 @@
 as_alice {
     local $ENV{SD_REPO} = $ENV{'PROPHET_REPO'};
     ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', repo_uri_for('bob') ] );
+
+
+    $alice_flyman_id = get_luid_for_uuid($flyman_uuid);
+
     run_output_matches(
         'sd',
         [ 'ticket',                             'list', '--regex', '.' ],
-        [ sort "$yatta_uuid YATTA (no status)", "$flyman_uuid Fly Man new", ]
+        [ sort "$alice_yatta_id YATTA (no status)", "$alice_flyman_id Fly Man new" ]
     );
 
     ( $ret, $out, $err ) = run_script( 'sd', [ 'push', '--to', $sd_rt_url ] );

Modified: sd/branches/usability/t/sd-rt.t
==============================================================================
--- sd/branches/usability/t/sd-rt.t	(original)
+++ sd/branches/usability/t/sd-rt.t	Sat May 17 09:10:32 2008
@@ -13,6 +13,7 @@
 }
 
 eval 'use Prophet::Test tests => 23';
+use App::SD::Test;
 
 no warnings 'once';
 
@@ -48,9 +49,9 @@
 
 my ( $ret, $out, $err );
 ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from',  $sd_rt_url ] );
-my ( $yatta_uuid, $flyman_uuid );
+my ( $yatta_id, $flyman_id );
 run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], 
-    [qr/(.*?)(?{ $flyman_uuid = $1 }) Fly Man new/] );
+    [qr/(.*?)(?{ $flyman_id = $1 }) Fly Man new/] );
 RT::Client::REST::Ticket->new(
     rt     => $rt,
     id     => $ticket->id,
@@ -59,20 +60,20 @@
 
 ( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_rt_url ] );
 
-run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], ["$flyman_uuid Fly Man open"] );
+run_output_matches( 'sd', [ 'ticket', 'list', '--regex', '.' ], ["$flyman_id Fly Man open"] );
 
 # create from sd and push
 
 run_output_matches(
     'sd',
     [ 'ticket', 'create', '--summary', 'YATTA', '--status', 'new' ],
-    [qr/Created ticket (.*)(?{ $yatta_uuid = $1 })/]
+    [qr/Created ticket (\d+)(?{ $yatta_id = $1 })/]
 );
 
 run_output_matches(
     'sd',
     [ 'ticket',                     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new", "$flyman_uuid Fly Man open", ]
+    [ sort "$yatta_id YATTA new", "$flyman_id Fly Man open" ]
 );
 
 ( $ret, $out, $err ) = run_script( 'sd', [ 'push', '--to', $sd_rt_url ] );
@@ -88,7 +89,7 @@
 run_output_matches(
     'sd',
     [ 'ticket',                     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new", "$flyman_uuid Fly Man open", ]
+    [ sort "$yatta_id YATTA new", "$flyman_id Fly Man open", ]
 );
 
 RT::Client::REST::Ticket->new(
@@ -102,7 +103,7 @@
 run_output_matches(
     'sd',
     [ 'ticket',                     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new", "$flyman_uuid Fly Man stalled", ]
+    [ sort "$yatta_id YATTA new", "$flyman_id Fly Man stalled", ]
 );
 
 RT::Client::REST::Ticket->new(
@@ -116,7 +117,7 @@
 run_output_matches(
     'sd',
     [ 'ticket',                      'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA open", "$flyman_uuid Fly Man stalled", ]
+    [ sort "$yatta_id YATTA open", "$flyman_id Fly Man stalled", ]
 );
 
 
@@ -136,14 +137,14 @@
 run_output_matches(
     'sd',
     [ 'ticket',                      'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA open", "$flyman_uuid Fly Man stalled", ]
+    [ sort "$yatta_id YATTA open", "$flyman_id Fly Man stalled", ]
 );
 
 diag("check to see if YATTA has an attachment");
 
 
 my $rt_attach_uuid;
-run_output_matches( sd => [qw/ticket attachment list --uuid/, $yatta_uuid], [qr/(.*?)(?{ $rt_attach_uuid = $1 }) bplogo.gif image\/gif/] ); 
+run_output_matches( sd => [qw/ticket attachment list --id/, $yatta_id], [qr/(.*?)(?{ $rt_attach_uuid = $1 }) bplogo.gif image\/gif/] ); 
 ok($rt_attach_uuid);
 
 diag("Check to see if YATTA's attachment is binary-identical to the original one");
@@ -160,7 +161,7 @@
 my $MAKEFILE_CONTENT =    file('Makefile.PL')->slurp;
 chomp($MAKEFILE_CONTENT); 
 my $makefile_attach_uuid;
-run_output_matches('sd', [qw/ticket attachment create --uuid/, $yatta_uuid, '--file', 'Makefile.PL'], [qr/Created attachment (.*?)(?{ $makefile_attach_uuid = $1})$/], [], "Added a attachment");
+run_output_matches('sd', [qw/ticket attachment create --id/, $yatta_id, '--file', 'Makefile.PL'], [qr/Created attachment (\d+) \((.*?)(?{ $makefile_attach_uuid = $2})\)/], [], "Added a attachment");
 
 
 

Modified: sd/branches/usability/t/sd-validation.t
==============================================================================
--- sd/branches/usability/t/sd-validation.t	(original)
+++ sd/branches/usability/t/sd-validation.t	Sat May 17 09:10:32 2008
@@ -3,7 +3,7 @@
 use strict;
 
 use Prophet::Test tests => 10;
-
+use App::SD::Test;
 no warnings 'once';
 
 BEGIN {
@@ -12,15 +12,12 @@
     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_id, $yatta_uuid) = create_ticket_ok(    '--summary', 'YATTA', '--status', 'new' );
+
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new"]
+    [  qr/(\d+) YATTA new/]
 );
 
 
@@ -34,7 +31,7 @@
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA new"]
+    [ qr/(\d+) YATTA new/]
 );
 
 
@@ -49,7 +46,7 @@
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA stalled"]
+    [ qr/(\d+) YATTA stalled/]
 );
 
 
@@ -63,7 +60,7 @@
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA stalled"]
+    [ qr/(\d+) YATTA stalled/]
 );
 
 
@@ -79,7 +76,7 @@
 
 run_output_matches( 'sd', [ 'ticket',  
     'list', '--regex', '.' ],
-    [ sort "$yatta_uuid YATTA stalled"]
+    [ qr/(\d+) YATTA stalled/]
 );
 
 



More information about the Bps-public-commit mailing list