- 11 MiB body -> 413 payload_too_large - truncated PNG -> 415 unsupported_media_type - MIME mismatch (PNG bytes as image/jpeg) -> 201, content_type image/png - outsider access to metadata and bytes -> 404 - foreign-chat attachment_id in message -> 404 - 11 attachment_ids -> 400 invalid_request - duplicate attachment_ids -> 400 invalid_request - empty filename -> 400 - path-traversal / backslash / NUL in filename -> 400 All rejections are 4xx; no 500 on user error.
25 lines
635 B
Python
25 lines
635 B
Python
#!/usr/bin/env python3
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
|
|
QUICK = ('test_cases.py', 'test_concurrency.py', 'test_auth.py', 'test_attachments.py')
|
|
|
|
def main():
|
|
args = sys.argv[1:]
|
|
failed = []
|
|
for script in QUICK:
|
|
print(f'=== {script} ===')
|
|
result = subprocess.run([sys.executable, str(ROOT / script), *args])
|
|
if result.returncode != 0:
|
|
failed.append(script)
|
|
if failed:
|
|
print('FAILED:', ', '.join(failed))
|
|
sys.exit(1)
|
|
print('=== Все тесты прошли ===')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |