Adding transfer test
This commit is contained in:
parent
e91949f6e9
commit
a8e5f9b06c
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Author: Alexander Epstein https://github.com/alexanderepstein
|
# Author: Alexander Epstein https://github.com/alexanderepstein
|
||||||
currentVersion="1.17.3"
|
currentVersion="1.17.3"
|
||||||
declare -a tools=(cheat cloudup crypt cryptocurrency currency geo movies newton qrify short siteciphers stocks taste todo weather ytview)
|
declare -a tools=(cheat cloudup crypt cryptocurrency currency geo movies newton qrify short siteciphers stocks taste todo transfer weather ytview)
|
||||||
declare -a extraLinuxTools=(maps)
|
declare -a extraLinuxTools=(maps)
|
||||||
declare -a extraDarwinTools
|
declare -a extraDarwinTools
|
||||||
usedGithubInstallMethod="0"
|
usedGithubInstallMethod="0"
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/env bats
|
||||||
|
|
||||||
|
@test "Testing transfer tool" {
|
||||||
|
echo transfer
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "Check for latest version of bash-snippets on update" {
|
||||||
|
if [[ "$(uname)" == "Linux" ]];then
|
||||||
|
run transfer update
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$output" = "Bash-Snippets is already the latest version" ]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "The -h option should print usage" {
|
||||||
|
run transfer -h
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "${lines[0]}" = "Transfer" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "Testing file upload" {
|
||||||
|
touch testFile.txt
|
||||||
|
echo -n "This is some example content." > $(pwd)/testFile.txt
|
||||||
|
run transfer -s testFile.txt
|
||||||
|
transferResponse=$(transfer -s testFile.txt)
|
||||||
|
rm -f $(pwd)/testFile.txt
|
||||||
|
transferCommand=$( echo $transferResponse | cut -d $'\n' -f 3 | sed s/"Transfer Download Command:"//g | sed s:"desiredOutputDirectory":"$HOME":g | sed s:"^ "::g)
|
||||||
|
transferStatus=$( echo $transferResponse | grep -Eo "Success!")
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$transferStatus" = "Success!" ] ## this works for darwin but the test wont
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#@test "Testing file download" {
|
||||||
|
# rm -f $HOME/testFile.txt
|
||||||
|
# run $(echo $transferCommand)
|
||||||
|
|
||||||
|
# contents=$(cat $HOME/testFile.txt)
|
||||||
|
# rm -f $HOME/testFile.txt
|
||||||
|
# if [[ $contents != "This is some example content." ]];then exit 1; fi
|
||||||
|
#}
|
||||||
|
|
||||||
|
@test "Get the tools version with -v" {
|
||||||
|
run transfer -v
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
result=$( echo $(transfer -v) | grep -Eo "Version")
|
||||||
|
[ "$result" = "Version" ]
|
||||||
|
}
|
|
@ -121,8 +121,7 @@ checkInternet()
|
||||||
singleDownload()
|
singleDownload()
|
||||||
{
|
{
|
||||||
if [[ ! -d $1 ]];then { echo "Directory doesn't exist, creating it now..."; mkdir -p $1;};fi
|
if [[ ! -d $1 ]];then { echo "Directory doesn't exist, creating it now..."; mkdir -p $1;};fi
|
||||||
if [[ $1 == "" ]];then tempOutputPath=$(pwd)
|
tempOutputPath=$1
|
||||||
else tempOutputPath=$1;fi
|
|
||||||
if [ -f "$tempOutputPath/$3" ];then
|
if [ -f "$tempOutputPath/$3" ];then
|
||||||
echo -n "File aleady exists at $tempOutputPath/$3, do you want to delete it? [Y/n] "
|
echo -n "File aleady exists at $tempOutputPath/$3, do you want to delete it? [Y/n] "
|
||||||
read -r answer
|
read -r answer
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Author: Alexander Epstein https://github.com/alexanderepstein
|
# Author: Alexander Epstein https://github.com/alexanderepstein
|
||||||
declare -a tools=(cheat cloudup crypt cryptocurrency currency geo movies newton qrify short siteciphers stocks taste todo weather ytview)
|
declare -a tools=(cheat cloudup crypt cryptocurrency currency geo movies newton qrify short siteciphers stocks taste todo transfer weather ytview)
|
||||||
all="1"
|
all="1"
|
||||||
|
|
||||||
askUninstall()
|
askUninstall()
|
||||||
|
|
Loading…
Reference in New Issue