[Bps-public-commit] net-lighthouse branch, master, updated. 11909ab8ca2f1eab12602b6b181fa2eb67acedb4

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Sep 8 02:55:19 EDT 2009


The branch, master has been updated
       via  11909ab8ca2f1eab12602b6b181fa2eb67acedb4 (commit)
      from  8a53ce1402f647bc921d3fecf63c0dc25983050f (commit)

Summary of changes:
 t/06-user.t |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 11909ab8ca2f1eab12602b6b181fa2eb67acedb4
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 8 14:55:13 2009 +0800

    test $user->memberships

diff --git a/t/06-user.t b/t/06-user.t
index 521f894..3a843a3 100644
--- a/t/06-user.t
+++ b/t/06-user.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 20;
+use Test::More tests => 26;
 use Test::Mock::LWP;
 
 use_ok( 'Net::Lighthouse::User' );
@@ -47,3 +47,25 @@ for my $attr ( keys %hash ) {
     is( $user->$attr, $hash{$attr}, "$attr is loaded" );
 }
 
+
+# test memberships
+$Mock_response->mock(
+    content => sub {
+        local $/;
+        open my $fh, '<', 't/data/user_67166_memberships.xml' or die $!;
+        <$fh>
+    }
+);
+my $memberships = $user->memberships;
+is( scalar @$memberships, 1, 'we got 1 membership' );
+isa_ok( $memberships->[0], 'Net::Lighthouse::User::Membership' );
+%hash = (
+    'account' => 'http://sunnavy.lighthouseapp.com',
+    'user_id' => '67166',
+    'id'      => '69274',
+    project   => undef,
+);
+
+for my $attr ( keys %hash ) {
+    is( $memberships->[0]->$attr, $hash{$attr}, "$attr is loaded" );
+}

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



More information about the Bps-public-commit mailing list