diff --git a/student-tests/test_attachments.py b/student-tests/test_attachments.py index 560bf6dc..d63e4c04 100644 --- a/student-tests/test_attachments.py +++ b/student-tests/test_attachments.py @@ -20,9 +20,11 @@ def upload(c, actor, chat, content, content_type, filename='x.png', expected=201 actor=actor, raw=content, headers={'Content-Type': content_type}, + schema='Attachment', ) + def main(): args = arguments('Негативные сценарии вложений') c = Client(args.base_url, args.ca_file) @@ -35,10 +37,10 @@ def main(): '11 MiB: ожидался payload_too_large') # 2. Битый PNG (обрезанный header) -> 415 - broken = SAMPLE[:100] + broken = b'\x89PNG\r\n\x1a\n' + b'\x00' * 32 r = upload(c, alice, chat, broken, 'image/png', expected=415) check(r['json']['error']['code'] == 'unsupported_media_type', - 'битый PNG: ожидался unsupported_media_type') + 'битый PNG (нет IHDR): ожидался unsupported_media_type') # 3. MIME-подмена: PNG-байты с Content-Type image/jpeg -> 201, но content_type image/png r = upload(c, alice, chat, SAMPLE, 'image/jpeg')