There may be a cleaner way to do this, but I like the way this mimics
a user's command line invocation.
... | ... |
@@ -341,6 +341,12 @@ test_s3cmd("List bucket recursive", ['ls', '--recursive', pbucket(1)], |
341 | 341 |
## ====== Clean up local destination dir |
342 | 342 |
test_flushdir("Clean testsuite-out/", "testsuite-out") |
343 | 343 |
|
344 |
+## ====== Put from stdin |
|
345 |
+cmd_args = ['cat', 'testsuite/single-file/single-file.txt', '|', 'python2', 's3cmd', 'put', '-', '%s/single-file/single-file.txt' % pbucket(1), '> /dev/null 2>&1'] |
|
346 |
+# hack - execute using os.system to match user's usage of s3cmd exactly |
|
347 |
+os.system(' '.join(cmd_args)) |
|
348 |
+test_s3cmd("Put from stdin", ['ls', '%s/single-file/single-file.txt' % pbucket(1)], |
|
349 |
+ must_find = ['%s/single-file/single-file.txt' % pbucket(1)]) |
|
344 | 350 |
|
345 | 351 |
## ====== Sync from S3 |
346 | 352 |
must_find = [ "File '%s/xyz/binary/random-crap.md5' stored as 'testsuite-out/xyz/binary/random-crap.md5'" % pbucket(1) ] |