rewrite tests and test --inplace ignore
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 14:50:35 +0000 (15:50 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 14:50:35 +0000 (15:50 +0100)
t/client.t

index 67cc9ed..e0a6845 100755 (executable)
@@ -6,27 +6,24 @@ use Test::More tests => 5;
 use Data::Dump qw(dump);
 use File::Slurp;
 
-my $user = 'u2001';
 $ENV{RSYNC_PASSWORD} = 'password';
 
 sub upload {
+       my $user = shift @_;
        system('rsync', '-vv', @_, "rsync://$user\@127.0.0.1:6501/$user/" ), "rsync @_ $user";
 }
 
 mkdir('/tmp/client');
 
-diag "create shared file one";
-
 ok write_file('/tmp/client/one', "one");
 
-ok upload('/tmp/client/one'), "upload $user";
-
-$user = 'u2002';
-ok upload('/tmp/client/one'), "upload $user";
+diag "reload rsync config with invalid username";
+upload('reload-config' => '/tmp/client/one');
 
+ok upload('u2001' => '/tmp/client/one'), "upload";
 
-diag "modify shared file one";
+ok upload('u2002' => '/tmp/client/one'), "upload shared";
 
-ok write_file('/tmp/client/one', "modified");
+ok write_file('/tmp/client/one', "modify");
 
-ok upload('/tmp/client/one'), "upload $user";
+ok upload('u2002' => '--inplace','/tmp/client/one'), "modify shared";