[Bps-public-commit] r12162 - in sd/trunk: .

jesse at bestpractical.com jesse at bestpractical.com
Thu May 8 17:46:54 EDT 2008


Author: jesse
Date: Thu May  8 17:46:53 2008
New Revision: 12162

Added:
   sd/trunk/t/attachment-content.t
Modified:
   sd/trunk/   (props changed)

Log:
 r30554 at 106 (orig r12114):  jesse | 2008-05-06 16:16:06 -0400
 * actually add the test file after svk failed to do so


Added: sd/trunk/t/attachment-content.t
==============================================================================
--- (empty file)
+++ sd/trunk/t/attachment-content.t	Thu May  8 17:46:53 2008
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Prophet::Test tests => 6;
+
+use File::Temp qw/tempdir/;
+use Path::Class;
+
+my $dir = tempdir(CLEANUP => 1);
+
+my $file=  file($dir => 'paper_order.doc');
+
+open (my $fh, ">" , $file) || die "Could not create $file: $!";
+print $fh "5 tonnes of hard white" || die "Could not write to file $file $!";
+close $fh || die $!;
+
+no warnings 'once';
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
+    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 })/]
+);
+
+run_output_matches( 'sd', [ 'ticket',  
+    'list', '--regex', '.' ],
+    [ sort "$yatta_uuid 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");
+ok($attachment_uuid);
+
+run_output_matches('sd', [qw/ticket attachments --uuid/, $yatta_uuid], [qr/^attachment id: $attachment_uuid/, 
+    'name: paper_order.doc', 
+    'content_type: 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");
+



More information about the Bps-public-commit mailing list