aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-12-26 02:39:46 +0100
committerPřemysl Eric Janouch <p@janouch.name>2023-12-26 02:39:46 +0100
commit8087042509ae7b09369d42e361ca73bda0c7c300 (patch)
tree71562296191c40b22226e4495a9ce1d713363077
parentb91074ba9f523e3b2cbd31ed1915430c8c65502c (diff)
downloadgallery-8087042509ae7b09369d42e361ca73bda0c7c300.tar.gz
gallery-8087042509ae7b09369d42e361ca73bda0c7c300.tar.xz
gallery-8087042509ae7b09369d42e361ca73bda0c7c300.zip
Make the test script shorter
-rwxr-xr-xtest.sh20
1 files changed, 8 insertions, 12 deletions
diff --git a/test.sh b/test.sh
index 007da25..a5136f4 100755
--- a/test.sh
+++ b/test.sh
@@ -16,18 +16,14 @@ cp -ra $HOME/Pictures/Anime $input
./gallery web $target :8080 &
web=$!
-echo '{"path":"/tmp/Gi"}' | \
-curl http://localhost:8080/api/browse -X POST --data-binary @-
-echo '{}' | \
-curl http://localhost:8080/api/tags -X POST --data-binary @-
-echo '{}' | \
-curl http://localhost:8080/api/duplicates -X POST --data-binary @-
-echo '{}' | \
-curl http://localhost:8080/api/orphans -X POST --data-binary @-
-echo '{"sha1":"d53fc82162fd19a6e7b92b401b08b7505dbf3dfd"}' | \
-curl http://localhost:8080/api/info -X POST --data-binary @-
-echo '{"sha1":"9539d9895ab8c25d76c321b23b8a327801a496bb"}' | \
-curl http://localhost:8080/api/similar -X POST --data-binary @-
+call() (curl http://localhost:8080/api/$1 -X POST --data-binary @-)
+
+echo '{"path":"/tmp/Gi"}' | call browse
+echo '{}' | call tags
+echo '{}' | call duplicates
+echo '{}' | call orphans
+echo '{"sha1":"d53fc82162fd19a6e7b92b401b08b7505dbf3dfd"}' | call info
+echo '{"sha1":"9539d9895ab8c25d76c321b23b8a327801a496bb"}' | call similar
kill $web || :
wait $web