aboutsummaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorMichael Grote2023-04-13 14:21:20 +0200
committerMichael Grote2023-04-13 14:21:20 +0200
commitd387c2af6d40f8687668c5b47ea6f2faff426074 (patch)
tree157558e049cf26477efe36504e38b283fcaab0c1 /tests.sh
parent131fec9964e21cfd352ade17ca348702c5d6c023 (diff)
add tests
Diffstat (limited to 'tests.sh')
-rw-r--r--tests.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
new file mode 100644
index 0000000..33a1f91
--- /dev/null
+++ b/tests.sh
@@ -0,0 +1,40 @@
+#!/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
+
+echo -e ${GREEN}Test: leerer Upload${ENDCOLOR}
+curl -X POST -H "token: $TOKEN" -F "file=@" $URL/upload
+
+echo -e ${GREEN}Test: fehlerhafter Dateiname Upload${ENDCOLOR}
+touch '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
+
+echo -e ${GREEN}Test: download Datei${ENDCOLOR}
+wget $URL/download/file -o ./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
+
+echo -e ${GREEN}Test: lösche nicht vorhandene Datei${ENDCOLOR}
+curl -X DELETE -H "token: $TOKEN" $URL/delete/file2
+
+rm -rf tests