[Bps-public-commit] r19748 - in Net-Google-Code/trunk: lib/Net/Google/Code lib/Net/Google/Code/Issue

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu May 21 03:11:29 EDT 2009


Author: sunnavy
Date: Thu May 21 03:11:29 2009
New Revision: 19748

Modified:
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm
   Net-Google-Code/trunk/t/02.issue.t
   Net-Google-Code/trunk/t/03.comment.t
   Net-Google-Code/trunk/t/04.attachment.t

Log:
attachment can load now

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue.pm	Thu May 21 03:11:29 2009
@@ -120,6 +120,7 @@
     @attachments =
       Net::Google::Code::Issue::Attachment->parse_attachments($att_tag)
       if $att_tag;
+    $_->load() for @attachments;
     $self->attachments( \@attachments );
 
     my ($meta) = $tree->look_down( id => 'issuemeta' );

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Issue/Comment.pm	Thu May 21 03:11:29 2009
@@ -71,6 +71,7 @@
     @attachments =
       Net::Google::Code::Issue::Attachment->parse_attachments($att_tag)
       if $att_tag;
+    $_->load() for @attachments;
     $self->attachments( \@attachments );
 
     return 1;

Modified: Net-Google-Code/trunk/t/02.issue.t
==============================================================================
--- Net-Google-Code/trunk/t/02.issue.t	(original)
+++ Net-Google-Code/trunk/t/02.issue.t	Thu May 21 03:11:29 2009
@@ -19,6 +19,9 @@
     sub { $content }
 );
 
+my $mock_att = Test::MockModule->new('Net::Google::Code::Issue::Attachment');
+$mock_att->mock( 'fetch', sub { '' } );
+
 use Net::Google::Code::Issue;
 my $issue = Net::Google::Code::Issue->new( project => 'test' );
 isa_ok( $issue, 'Net::Google::Code::Issue', '$issue' );

Modified: Net-Google-Code/trunk/t/03.comment.t
==============================================================================
--- Net-Google-Code/trunk/t/03.comment.t	(original)
+++ Net-Google-Code/trunk/t/03.comment.t	Thu May 21 03:11:29 2009
@@ -4,10 +4,17 @@
 use Test::More tests => 9;
 
 use Net::Google::Code::Issue::Comment;
+use Test::MockModule;
 my $comment =
   Net::Google::Code::Issue::Comment->new( project => 'test' );
 isa_ok( $comment, 'Net::Google::Code::Issue::Comment', '$comment' );
 
+my $mock = Test::MockModule->new('Net::Google::Code::Issue::Attachment');
+$mock->mock(
+    'fetch',
+    sub { '' }
+);
+
 my $content;
 {
         local $/;

Modified: Net-Google-Code/trunk/t/04.attachment.t
==============================================================================
--- Net-Google-Code/trunk/t/04.attachment.t	(original)
+++ Net-Google-Code/trunk/t/04.attachment.t	Thu May 21 03:11:29 2009
@@ -1,8 +1,9 @@
 use strict;
 use warnings;
 
-use Test::More tests => 6;
+use Test::More tests => 8;
 
+use Test::MockModule;
 use Net::Google::Code::Issue::Attachment;
 my $attachment = Net::Google::Code::Issue::Attachment->new( project => 'test' );
 isa_ok( $attachment, 'Net::Google::Code::Issue::Attachment', '$attachment' );
@@ -14,6 +15,12 @@
         $content = <DATA>;
 }
 
+my $mock = Test::MockModule->new('Net::Google::Code::Issue::Attachment');
+$mock->mock(
+    'fetch',
+    sub { 'png' }
+);
+
 use HTML::TreeBuilder;
 my $tree = HTML::TreeBuilder->new;
 $tree->parse_content($content);
@@ -22,6 +29,7 @@
 my @tr = $tree->find_by_tag_name('tr');
 is( scalar @tr, 2, '@tr has 2 elements' );
 $attachment->parse( $content );
+$attachment->load;
 
 my %info = (
     url =>
@@ -29,6 +37,8 @@
     name => 'proxy_settings.png',
     size => '14.3 KB',
     id   => '-1323983749556004507',
+    content_type => 'image/png',
+    content => 'png',
 );
 
 for my $item ( keys %info ) {



More information about the Bps-public-commit mailing list