mirror of
https://github.com/mikedilger/chorus.git
synced 2026-01-03 06:15:33 +00:00
Improve test_blossom
This commit is contained in:
parent
3cacc4e963
commit
7d91a47ac2
BIN
test_blossom/Example.png
Normal file
BIN
test_blossom/Example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB |
@ -25,9 +25,9 @@ allow_scrape_if_max_seconds = 7200
|
||||
max_subscriptions = 128
|
||||
serve_ephemeral = true
|
||||
serve_relay_lists = true
|
||||
server_log_level = "Info"
|
||||
library_log_level = "Info"
|
||||
client_log_level = "Warn"
|
||||
server_log_level = "Debug"
|
||||
library_log_level = "Debug"
|
||||
client_log_level = "Debug"
|
||||
enable_ip_blocking = true
|
||||
minimum_ban_seconds = 1
|
||||
timeout_seconds = 60
|
||||
|
||||
@ -20,20 +20,23 @@ fi
|
||||
|
||||
# UPLOAD TEST ------------
|
||||
|
||||
FILE="./avatar-placeholder.webp"
|
||||
FILE="./Example.png"
|
||||
HASH=$(sha256sum $FILE | awk '{print $1}')
|
||||
|
||||
# Generate nostr auth
|
||||
AUTH=$(./create_auth.sh upload $HASH)
|
||||
|
||||
# Upload
|
||||
DESCRIPTOR=$(curl -s --data-binary @"$FILE" -X PUT --header "$AUTH" http://127.0.0.1:8089/upload)
|
||||
# Upload (note we clobber the content type)
|
||||
DESCRIPTOR=$(curl -vfs --data-binary @"$FILE" -H "Content-Type: " -X PUT --header "$AUTH" http://127.0.0.1:8089/upload)
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "FAILED: Curl (uploading) exited with a non-zero status"
|
||||
exit 1
|
||||
fi
|
||||
echo "PASS: FILE UPLOADED"
|
||||
|
||||
## FIXME check for 4xx and 5xx error codes
|
||||
|
||||
|
||||
# Extract the sha256 and compare it
|
||||
DHASH=$(echo "$DESCRIPTOR" | jq -r .sha256)
|
||||
if [ $? -ne 0 ] ; then
|
||||
@ -42,6 +45,7 @@ if [ $? -ne 0 ] ; then
|
||||
fi
|
||||
if [ "$HASH" != "$DHASH" ] ; then
|
||||
echo "returned descriptor 'sha256' does not match the hash"
|
||||
exit 1
|
||||
fi
|
||||
echo "PASS: DESCRIPTOR HASH MATCHES"
|
||||
|
||||
@ -52,6 +56,8 @@ if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Descriptor URL = $URL"
|
||||
|
||||
# DOWNLOAD TEST -----------
|
||||
|
||||
curl -s "$URL" > downloaded
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user