check whole API for all test users
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Apr 2012 19:57:45 +0000 (21:57 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 15 Apr 2012 19:57:45 +0000 (21:57 +0200)
t/Gearman.t

index 8e211b4..dd79089 100755 (executable)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 43;
+use Test::More tests => 47;
 use Data::Dump qw(dump);
 
 use lib 'lib';
@@ -12,8 +12,6 @@ use_ok 'CloudStore::Gearman';
 my $hostname = `hostname -s`;
 chomp $hostname;
 
-my $user = $ARGV[0] || 2001;
-
 sub gearman {
        my ( $function, $args ) = @_;
        ok( my $o = CloudStore::Gearman->gearman_do( @_ ), join(' ',@_) );
@@ -39,11 +37,13 @@ like $u2, qr/u\d+/, "login $u2";
 my $u3 = gearman 'create_user' => 'slice2@example.com secret 0';
 like $u3, qr/u\d+/, "login $u2 (on other slice)";
 
-my $o = gearman $hostname . '_s1_quota_get' => $user;
-diag dump $o;
-cmp_ok $o, '=~', qr/^(\d+)\s+(\d+)$/, 'format: used quota';
+foreach my $login ( $u1, $u2, $u3 ) {
+       my $o = gearman $hostname . '_s1_quota_get' => $login;
+       diag dump $o;
+       cmp_ok $o, '=~', qr/^(\d+)\s+(\d+)$/, 'format: used quota';
+}
 
-gearman( 'user_usage' => $user );
+gearman( 'user_usage' => $u1 );
 
 gearman( $hostname . '_s1_torrent_list' );