correctly create test file
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 12 Dec 2011 00:08:54 +0000 (01:08 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 12 Dec 2011 00:08:54 +0000 (01:08 +0100)
lib/CloudStore/API.pm
t/Store.t

index d8e5319..f552cf0 100644 (file)
@@ -74,7 +74,7 @@ sub create_user {
 }
 
 sub mkbasepath {
-       my ($path,$opts) = @_;
+       my ($self,$path,$opts) = @_;
        $path =~ s{/[^/]+$}{};
        make_path $path unless -d $path;
 }
@@ -135,7 +135,7 @@ sub send_file {
        my $f_full = "$f->{dir}/$f_path";
        my $t_full = "$t->{dir}/$t_path";
 
-       mkbasepath $t_full, { uid => $t->{uid} };
+       $self->mkbasepath( $t_full, { uid => $t->{uid} } );
 
        my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat $f_full;
        if ( $uid == $f->{uid} ) {
index 31491ed..4b601f7 100755 (executable)
--- a/t/Store.t
+++ b/t/Store.t
@@ -14,7 +14,7 @@ my $data =
   file       => "test/store",
   itemize    => ">f+++++++++",
   login      => "u2001",
-  md5        => "51ce99ec40129bfe1fd11d65b346d15e",
+  md5        => "d8e8fca2dc0f896fd7cb4cb0031ba249",
   mtime      => "2011-07-17T17:55:15",
   op         => "recv",
   perms      => "rw-r--r--",
@@ -35,11 +35,12 @@ ok my $u = $r->{api}->user_info('u2001'), 'user_info';
 ok $r->init_pid_login( $data->{pid}, $data->{login} ), 'init_pid_login';
 
 ok my $full_path = $r->blob_path( $data ), 'blob_path';
+diag $full_path;
 
 if ( ! -e $full_path ) {
-       $r->
-       open(my $fh, '>', $full_path);
-       print $fh "test\n";
+       $r->{api}->mkbasepath( $full_path, { uid => $u->{uid} } );
+       open(my $fh, '>', $full_path) || die $!;
+       print $fh "test\n" || die $!;
        close $fh;
        diag "$full_path created";
 }