Files
2026-11-16 20:30:12 +03:00

25 lines
897 B
Python

#!/usr/bin/env python3
"""Реестр failed доступен оператору (SELECT из attachment_jobs)."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from tests.client import Client, check
from student_tests.common import upload, wait_status, psql, ok, fail
def main():
c = Client()
a, b, e, ch = c.bootstrap()
content = Path('tests/fixtures/sample.png').read_bytes()[:-20]
att = upload(c, a, ch, content)
wait_status(c, a, att['id'], 'failed', seconds=180)
rows = psql(
"SELECT attachment_id, last_error_code, attempt FROM attachment_jobs "
"WHERE status='failed' ORDER BY updated_at DESC LIMIT 5")
check(rows, 'no failed jobs visible to operator')
ok('failed registry:\n' + rows)
if __name__ == '__main__':
try:
main()
except Exception as exc:
fail(str(exc))