check.sh - transferwee - Download/upload file via wetransfer.com
 (HTM) git clone https://github.com/iamleot/transferwee
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
       check.sh (905B)
       ---
            1 #!/bin/sh
            2 
            3 #
            4 # Test transferwee by uploading and then downloading a test file.
            5 #
            6 # To run this test, just invoke:
            7 #  % ./check.sh
            8 #
            9 
           10 TRANSFERWEE=$(readlink -f ../transferwee.py)
           11 
           12 set -e
           13 
           14 testtmpdir=$(mktemp -d '/tmp/transferwee_test_XXXXXX')
           15 testtmpfile=hello
           16 
           17 cd "${testtmpdir}"
           18 
           19 echo "Creating a test file..."
           20 echo "Hello world!" > "${testtmpfile}"
           21 
           22 echo "Uploading the test file..."
           23 url=$(${TRANSFERWEE} upload -m 'Just a text file with the mandatory message...' "${testtmpfile}")
           24 echo "test file uploaded as ${url}"
           25 
           26 echo "Renaming original test file..."
           27 mv "${testtmpfile}" "${testtmpfile}.orig"
           28 
           29 echo "Waiting 10 seconds before downloading the file..."
           30 sleep 10
           31 
           32 echo "Downloading the test file via ${url}..."
           33 ${TRANSFERWEE} download "${url}"
           34 
           35 echo "Checking if the uploaded file and downloaded file are the same..."
           36 cmp "${testtmpfile}.orig" "${testtmpfile}"
           37 
           38 cd "${OLDPWD}"
           39 rm -rf "${testtmpdir}"