test send_file with spaces in both arguments
[cloudstore.git] / t / Gearman.t
index dd79089..c2df62f 100755 (executable)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 47;
+use Test::More tests => 55;
 use Data::Dump qw(dump);
 
 use lib 'lib';
@@ -30,11 +30,13 @@ sub test_refresh_file_list {
        gearman list_files => "~$login";
 }
 
-my $u1 = gearman 'create_user' => 'test@example.com secret 0';
+my $quota = 5 * 1024 * 1024;
+
+my $u1 = gearman 'create_user' => 'test@example.com secret ' . $quota;
 like $u1, qr/u\d+/, "login $u1";
-my $u2 = gearman 'create_user' => 'test2@example.com secret 0';
+my $u2 = gearman 'create_user' => 'test2@example.com secret ' . ($quota + 1);
 like $u2, qr/u\d+/, "login $u2";
-my $u3 = gearman 'create_user' => 'slice2@example.com secret 0';
+my $u3 = gearman 'create_user' => 'slice2@example.com secret ' . ($quota + 2);
 like $u3, qr/u\d+/, "login $u2 (on other slice)";
 
 foreach my $login ( $u1, $u2, $u3 ) {
@@ -58,9 +60,18 @@ file_exists "~$u1/foo.txt" || BAIL_OUT("~$u1/foo.txt is required for rest of tes
 gearman send_file => "~$u1/foo.txt#~$u2/dir with space/file with space";
 test_refresh_file_list "$u2";
 
+my $files = gearman list_files => "~$u2";
+like $files, qr|dir with space/file with space|, 'found sent file in list_files';
+
+gearman send_file => "~$u2/dir with space/file with space#~$u3/another dir with spaces/and file with spaces";
+test_refresh_file_list "$u3";
+
 gearman delete => "~$u2/dir with space/file with space";
 test_refresh_file_list "$u2";
 
+gearman delete => "~$u3/another dir with spaces/and file with spaces";
+test_refresh_file_list "$u3";
+
 gearman send_file => "~$u1/foo.txt#~$u2/foo.txt";
 test_refresh_file_list "$u2";