diff --git a/app/printjobs.py b/app/printjobs.py index 226004f..b773bd7 100644 --- a/app/printjobs.py +++ b/app/printjobs.py @@ -176,6 +176,8 @@ def footer(job, item): def produce(storage, job, item, uploads): """Fetch the item's artwork and render it. Returns (folder, [(png path, name)], evidence); the caller removes the folder.""" + if not (item.get('production') or {}).get('placements'): + raise Unsupported('o item não tem montagem: prepare o arquivo à mão') for upload_id in item['uploads']: row = uploads.get(upload_id) if not row or row['scan_state'] != 'clean': diff --git a/tests/retention_test.py b/tests/retention_test.py index 1a8c4d0..9bd4581 100644 --- a/tests/retention_test.py +++ b/tests/retention_test.py @@ -18,7 +18,12 @@ def run(): with connect() as c: c.execute('INSERT INTO dtf_local.uploads(id,owner,name,size,object_key,multipart_id,complete,expires_at) VALUES(%s,%s,%s,%s,%s,%s,true,%s)', (uid,uuid4(),'LOCAL-RETENTION-TEST.txt',len(b'LOCAL RETENTION TEST'),key,upload,expiry)) - cleanup() + # Cleanup takes 50 at a time, oldest first: the suites before this one + # leave their own expired files ahead of the fixture. + for _ in range(100): + cleanup() + with connect() as c: + if c.execute('SELECT purged_at FROM dtf_local.uploads WHERE id=%s',(ids[0],)).fetchone()['purged_at']:break with connect() as c: assert c.execute('SELECT purged_at FROM dtf_local.uploads WHERE id=%s',(ids[0],)).fetchone()['purged_at'] assert not c.execute('SELECT purged_at FROM dtf_local.uploads WHERE id=%s',(ids[1],)).fetchone()['purged_at']