Browse code

Merge branch 'master' of ssh://github.com/s3tools/s3cmd

Michal Ludvig authored on 2014/03/14 12:31:57
Showing 2 changed files
... ...
@@ -138,8 +138,9 @@ def test(label, cmd_args = [], retcode = 0, must_find = [], must_not_find = [],
138 138
 
139 139
     p = Popen(cmd_args, stdout = PIPE, stderr = STDOUT, universal_newlines = True)
140 140
     stdout, stderr = p.communicate()
141
-    if retcode != p.returncode:
142
-        return failure("retcode: %d, expected: %d" % (p.returncode, retcode))
141
+    if type(retcode) not in [list, tuple]: retcode = [retcode]
142
+    if p.returncode not in retcode:
143
+        return failure("retcode: %d, expected one of: %s" % (p.returncode, retcode))
143 144
 
144 145
     if type(must_find) not in [ list, tuple ]: must_find = [must_find]
145 146
     if type(must_find_re) not in [ list, tuple ]: must_find_re = [must_find_re]
... ...
@@ -379,8 +380,8 @@ test_s3cmd("Change ACL to Private", ['setacl', '--acl-private', '%s/xyz/etc/l*.p
379 379
 ## ====== Verify Private ACL
380 380
 if have_wget:
381 381
     test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://%s.%s/xyz/etc/logo.png' % (bucket(1), cfg.host_base)],
382
-        retcode = 8,
383
-        must_find_re = [ 'ERROR 403: Forbidden' ])
382
+         retcode = [1, 8],
383
+         must_find_re = [ 'ERROR 403: Forbidden' ])
384 384
 
385 385
 
386 386
 ## ====== Change ACL to Public
... ...
@@ -543,14 +543,14 @@ def subcmd_batch_del(uri_str = None, bucket = None, remote_list = None):
543 543
             response = s3.object_batch_delete(remote_list)
544 544
             output('\n'.join((u"File %s deleted" % remote_list[p]['object_uri_str']) for p in remote_list))
545 545
 
546
-        if remote_list:
546
+        if len(remote_list):
547 547
             keys_count = len(remote_list)
548 548
         else:
549 549
             keys_count = 0
550 550
         if keys_count < 1000 or not batch_mode:
551 551
             break
552 552
 
553
-        if remote_list:
553
+        if len(remote_list):
554 554
             last_key = S3Uri(remote_list[remote_list.keys()[-1]]['object_uri_str'])
555 555
         else:
556 556
             last_key = None
... ...
@@ -687,11 +687,11 @@ def subcmd_cp_mv(args, process_fce, action_str, message):
687 687
 
688 688
 def cmd_cp(args):
689 689
     s3 = S3(Config())
690
-    subcmd_cp_mv(args, s3.object_copy, "copy", "File %(src)s copied to %(dst)s")
690
+    subcmd_cp_mv(args, s3.object_copy, "copy", u"File %(src)s copied to %(dst)s")
691 691
 
692 692
 def cmd_mv(args):
693 693
     s3 = S3(Config())
694
-    subcmd_cp_mv(args, s3.object_move, "move", "File %(src)s moved to %(dst)s")
694
+    subcmd_cp_mv(args, s3.object_move, "move", u"File %(src)s moved to %(dst)s")
695 695
 
696 696
 def cmd_info(args):
697 697
     s3 = S3(Config())