-
Notifications
You must be signed in to change notification settings - Fork 27
/
test.sh
executable file
·69 lines (50 loc) · 2.03 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env sh
set -e
# gdrive IDs
FILE_ID="14eh2_N3rGeGzUMamk2uyoU_CF9O7YUkA"
DOCUMENT_ID="1Dziv2X5_UCMQ2weMI9duSUT6iayMikqRdoftJCwq_vg"
FOLDER_ID="1AC0UsKfLZfflIkO7Ork78et5VzIvFSDM"
_test() (
shell="${1:?Error: Specify shell name.}"
use_key="${2}"
cd "release/${shell}" || exit 1
count=0
_error() {
printf "%s\n" "Error: Test $((count += 1)) failed for ${shell} ${use_key}."
exit 1
}
_success() {
printf "\n%s\n\n" "Success: Test $((count += 1)) passed for ${shell} ${use_key}."
}
### Folder ###
./gdl --skip-internet-check "https://drive.google.com/folderview?id=${FOLDER_ID}&usp=sharing" -d Test "${use_key:-}" -aria || _error
_success
./gdl --skip-internet-check "https://drive.google.com/drive/u/0/mobile/folders/${FOLDER_ID}" -d Test -p 2 "${use_key:-}" || _error
_success
# Do a check for log message when trying to download an existing folder contents
./gdl --skip-internet-check "https://drive.google.com/drive/folders/${FOLDER_ID}" -d Test "${use_key:-}" || _error
_success
rm -rf Test/
### File ###
./gdl --skip-internet-check "https://drive.google.com/file/d/${FILE_ID}/view?usp=drivesdk" -d Test "${use_key:-}" -aria || _error
_success
#./gdl --skip-internet-check "https://drive.google.com/uc?id=${FILE_ID}&export=download" -d Test "${use_key:-}"
#rm -rf Test/
#./gdl --skip-internet-check "https://drive.google.com/open?id=${FILE_ID}" -d Test "${use_key:-}"
# Do a check for log message when trying to download an existing file
./gdl --skip-internet-check "https://docs.google.com/file/d/${FILE_ID}/edit" -d Test "${use_key:-}" || _error
_success
### Document ###
./gdl --skip-internet-check "https://docs.google.com/document/d/${DOCUMENT_ID}/edit?usp=sharing" -d Test "${use_key:-}" || _error
_success
rm -rf Test/
# Do a test for invalid url/id
./gdl --skip-internet-check "testid" || _error
_success
)
# Test with sh
_test sh
_test sh --key
# Test with bash
_test bash
_test bash --key