Files
mtusi2026lab4/student-tests/test_attachment_mime_spoof.sh
2026-10-30 21:09:56 +03:00

18 lines
476 B
Bash
Executable File

#!/bin/sh
# JPEG bytes with Content-Type: image/png → 415 (content wins over header).
set -eu
. "$(dirname "$0")/lib.sh"
jpg="$FIXTURES/tiny.jpg"
[ -f "$jpg" ] || die "missing fixture $jpg"
register_user alice
create_chat 'mime-spoof' "[\"$USER_ID\"]"
upload_file "$CHAT_ID" "$jpg" 'spoof.png' 'image/png'
expect_code 415
code=$(printf '%s' "$HTTP_BODY" | jq -r .error.code)
assert_eq "$code" unsupported_media_type error_code
printf 'PASS test_attachment_mime_spoof\n'