5 use Test::More tests => 27;
6 use Data::Dump qw(dump);
10 use_ok 'CloudStore::API';
12 ok my $o = CloudStore::API->new('s1'), 'new';
14 ok exists $o->{SLICE}, 'SLICE';
16 cmp_ok $o->create_user('md5@example.com','md5sum',0), '==', 2000, 'create_user md5';
18 ok my $info = $o->user_info( 'md5' ), 'user_info';
21 cmp_ok $info->{uid}, '==', 2000, 'uid';
23 ok my $uid = $o->create_user('test@example.com','password',100_000_000), 'create_user test';
25 ok my $test = $o->user_info( $uid ), "user_info $uid";
28 ok open(my $fh, ">", $test->{dir} . '/foo.txt'), 'open';
29 ok print($fh "test pid: $$\n"), 'print';
30 ok close($fh) , 'close';
31 ok chown $test->{uid}, $test->{gid}, "$test->{dir}/foo.txt", 'chown';
33 ok my $uid2 = $o->create_user('test2@example.com','password',100_000_000), 'create_user test2';
34 ok my $test2 = $o->user_info( $uid2 ), "user_info $uid2";
36 foreach ( $test->{dir}, $test2->{dir} ) {
42 ok my $u = $o->usage( $_[0] ), 'usage';
46 ok $o->send_file( $uid => '/foo.txt', $uid2 => 'dir1/dir2/bar.txt' ), 'send_file';
50 ok $o->send_file( $uid2 => 'dir1/dir2/bar.txt', $uid => 'bar.txt' ), 'send_file back';
54 ok $o->send_file( $uid2 => 'dir1/dir2/bar.txt', 2004 => 'bar.txt' ), 'send_file cross-slice';
56 ok $o->delete( $uid, 'foo.txt' );
59 ok $o->delete( $uid2, 'dir1' );
62 ok $o->delete( $uid, 'bar.txt' );