[Bps-public-commit] Net-Google-Code branch, issues-api, updated. 51895d32d5834c19446b6fa53b94eac7e7820f96

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Oct 19 08:28:55 EDT 2009


The branch, issues-api has been updated
       via  51895d32d5834c19446b6fa53b94eac7e7820f96 (commit)
       via  48e592c8fbc337a9c704374f9743220e7e289258 (commit)
      from  3167033dfcb514451b6cde20a1b69aa62ec54bd1 (commit)

Summary of changes:
 lib/Net/Google/Code/Issue.pm |   20 ++++++++++++++++++++
 t/02.issue.t                 |   12 +++++++++---
 t/google_api/01-issue.t      |    5 +++--
 3 files changed, 32 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 48e592c8fbc337a9c704374f9743220e7e289258
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Oct 19 20:17:54 2009 +0800

    add merged attr existance test

diff --git a/t/02.issue.t b/t/02.issue.t
index 9733d25..6b757c9 100644
--- a/t/02.issue.t
+++ b/t/02.issue.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 22;
 use Test::MockModule;
 
 # $content is a real page: http://code.google.com/p/chromium/issues/detail?id=14
@@ -60,9 +60,10 @@ my @labels = (
     'intext',   'Mstone-X', 'Foo-Bar-Baz',
 );
 
-for my $item ( qw/id summary description owner cc reporter status closed/ ) {
+for my $item (qw/id summary description owner cc reporter status closed merged/)
+{
     if ( defined $info{$item} ) {
-        is ( $issue->$item, $info{$item}, "$item is extracted" );
+        is( $issue->$item, $info{$item}, "$item is extracted" );
     }
     else {
         ok( !defined $issue->$item, "$item is not defined" );

commit 51895d32d5834c19446b6fa53b94eac7e7820f96
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Oct 19 20:27:44 2009 +0800

    stars attr for issue

diff --git a/lib/Net/Google/Code/Issue.pm b/lib/Net/Google/Code/Issue.pm
index 3c84536..7e34e05 100644
--- a/lib/Net/Google/Code/Issue.pm
+++ b/lib/Net/Google/Code/Issue.pm
@@ -55,6 +55,11 @@ has 'merged' => (
     is  => 'rw',
 );
 
+has 'stars' => (
+    isa => 'Int',
+    is  => 'rw',
+);
+
 has 'closed' => (
     isa => 'Str',
     is  => 'rw',
@@ -146,6 +151,19 @@ sub parse {
     $self->attachments( \@attachments );
 
     my ($meta) = $tree->look_down( id => 'issuemeta' );
+    {
+
+        # let's find stars
+        my ($header) = $tree->look_down( id => 'issueheader' );
+        if (   $header
+            && $header->as_text =~ /(\d+) \w+ starred this issue/ )
+        {
+# the \w+ is person or people, I don't know if google will change that word
+# some time, so just use \w+
+            $self->stars($1);
+        }
+    }
+
     my @meta = $meta->find_by_tag_name('tr');
     my @labels;
     for my $meta (@meta) {
@@ -665,6 +683,8 @@ user's email and password
 
 =item merged
 
+=item stars
+
 =item closed
 
 =item cc
diff --git a/t/02.issue.t b/t/02.issue.t
index 6b757c9..3055b1e 100644
--- a/t/02.issue.t
+++ b/t/02.issue.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 22;
+use Test::More tests => 23;
 use Test::MockModule;
 
 # $content is a real page: http://code.google.com/p/chromium/issues/detail?id=14
@@ -53,6 +53,8 @@ my %info = (
     reporter    => 'seanamonroe',
     status => 'Available',
     closed => undef,
+    merged => undef,
+    stars => 34,
 );
 
 my @labels = (
@@ -60,7 +62,10 @@ my @labels = (
     'intext',   'Mstone-X', 'Foo-Bar-Baz',
 );
 
-for my $item (qw/id summary description owner cc reporter status closed merged/)
+for my $item (
+    qw/id summary description owner cc reporter status closed merged
+    stars/
+  )
 {
     if ( defined $info{$item} ) {
         is( $issue->$item, $info{$item}, "$item is extracted" );
diff --git a/t/google_api/01-issue.t b/t/google_api/01-issue.t
index 46b7503..7977103 100644
--- a/t/google_api/01-issue.t
+++ b/t/google_api/01-issue.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 33;
+use Test::More tests => 35;
 use Test::Mock::LWP;
 use DateTime;
 
@@ -22,7 +22,7 @@ isa_ok( $issue, 'Net::Google::Code::Issue::Base' );
 
 my @attrs =
   qw/ reported id reporter status owner summary description
-  labels cc comments/;
+  labels cc comments stars/;
 
 for my $attr (@attrs) {
     can_ok( $issue, $attr );
@@ -54,6 +54,7 @@ my %hash = (
     'status'      => 'Accepted',
     'summary'     => 'test attachment 8',
     'id'          => '8',
+    'stars'       => 1,
 );
 
 for my $k ( keys %hash ) {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list