blob: 313f44e9b0603a706bed7a81abf344719c98c528 (
plain)
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
|
#!/bin/bash
# führe Script nach Fehlern weiter aus
set +e
RED="\e[31m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
export TOKEN=myuploadtoken
export URL="http://docker10.grote.lan:5040"
mkdir -p tests
echo -e ${GREEN}Test: normaler Upload${ENDCOLOR}
touch tests/file
curl -X POST -H "token: $TOKEN" -F "file=@tests/file" $URL/upload | jq
echo -e ${GREEN}Test: leerer Upload${ENDCOLOR}
curl -X POST -H "token: $TOKEN" $URL/upload
echo -e ${GREEN}Test: fehlerhafter Dateiname Upload${ENDCOLOR}
touch ./tests/'hallo\welt.txt'
curl -X POST -H "token: $TOKEN" -F "file=@tests/hallo\welt.txt" $URL/upload
echo -e ${GREEN}Test: List Files${ENDCOLOR}
curl -H "token: $TOKEN" $URL/list | jq
echo -e ${GREEN}Test: download Datei${ENDCOLOR}
wget $URL/download/file -o ./tests/file
ls -lah ./tests/file
echo -e ${GREEN}Test: download nicht vorhandene Datei${ENDCOLOR}
wget $URL/download/file2
echo -e ${GREEN}Test: lösche Datei${ENDCOLOR}
curl -X DELETE -H "token: $TOKEN" $URL/delete/file | jq
echo -e ${GREEN}Test: lösche nicht vorhandene Datei${ENDCOLOR}
curl -X DELETE -H "token: $TOKEN" $URL/delete/file2 | jq
rm -rf tests
|