[Bps-public-commit] r12120 - in sd/branches/attachment-content: bin

jesse at bestpractical.com jesse at bestpractical.com
Tue May 6 19:24:08 EDT 2008


Author: jesse
Date: Tue May  6 19:24:06 2008
New Revision: 12120

Modified:
   sd/branches/attachment-content/bin/sd
   sd/branches/attachment-content/t/attachment-content.t

Log:
* binary attachments. 

Modified: sd/branches/attachment-content/bin/sd
==============================================================================
--- sd/branches/attachment-content/bin/sd	(original)
+++ sd/branches/attachment-content/bin/sd	Tue May  6 19:24:06 2008
@@ -66,7 +66,7 @@
     my $self = shift;
     my $record =  $self->_get_record;
     $record->load(uuid => $self->cli->uuid);
-    print $record->prop('content') ."\n";
+    print $record->prop('content');
 }
 
 package App::SD::CLI::Command::Help;

Modified: sd/branches/attachment-content/t/attachment-content.t
==============================================================================
--- sd/branches/attachment-content/t/attachment-content.t	(original)
+++ sd/branches/attachment-content/t/attachment-content.t	Tue May  6 19:24:06 2008
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Prophet::Test tests => 6;
+use Prophet::Test tests => 10;
 
 use File::Temp qw/tempdir/;
 use Path::Class;
@@ -42,6 +42,20 @@
     '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");
 
+
+diag("Add a binary attachment");
+
+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");
+
+my $image_data = file($image_file)->slurp;
+
+my ($ret, $stdout, $stderr) = run_script('sd', [qw/attachment content --uuid/, $image_attach]);
+ok($ret, "Ran the script ok");
+is($stdout, $image_data, "We roundtripped some binary");
+is($stderr, '');
+



More information about the Bps-public-commit mailing list