feat: the proof card, machine pull and print file corrections (Dropstar, 05/11)
The proof card owns its final PNG, keeps its parent locked until the seller answers, enters the queue first, and shares one machine with the parent. The board no longer assigns a machine at payment; the puller records it. A stalled print file times out with a card warning and a retry, finished orders sort by completion, and finals are stored as PNG. The original download carries the order number (items 0.1, 0.4 to 0.7 and 0.9).
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import os
|
||||
from uuid import uuid4
|
||||
from urllib.request import urlopen
|
||||
from tests.smoke_test import Client, approved_quote, upload_bytes, item_spec, register
|
||||
from tests.smoke_test import Client, approved_quote, upload_bytes, item_spec, register, final_png_bytes
|
||||
|
||||
def run():
|
||||
customer=Client();other=Client();customer.call('/session');other.call('/session')
|
||||
@@ -55,7 +55,8 @@ def run():
|
||||
# Arte conferida is the print queue (2026-10-23): it takes approved finals only.
|
||||
version=0
|
||||
customer.call('/operator/orders/'+oid+'/move',{'state':'tra','version':version},operator=True,expected=409)
|
||||
final_id=upload_bytes(customer,b'LOCAL FINAL VERSION ONE',order_id=oid)
|
||||
final_one=final_png_bytes('final one')
|
||||
final_id=upload_bytes(customer,final_one,name='LOCAL-FINAL-ONE.png',order_id=oid)
|
||||
customer.call('/uploads/'+final_id,expected=404)
|
||||
body={'version':version,'files':[{'item_index':0,'upload_id':final_id}],'note':'Manually checked final'}
|
||||
customer.call('/operator/orders/'+oid+'/final-files',body,expected=401)
|
||||
@@ -67,21 +68,21 @@ def run():
|
||||
detail=customer.call('/customer/orders/'+oid)
|
||||
final=detail['files'][0]
|
||||
link=customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download')
|
||||
assert urlopen(link['url']).read()==b'LOCAL FINAL VERSION ONE'
|
||||
assert urlopen(link['url']).read()==final_one
|
||||
guest=Client();guest.call('/session');guest.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
||||
version=move('tra',version)
|
||||
# The print queue's files come named after their order, straight from storage.
|
||||
queued=customer.call('/operator/queue/finals',operator=True)['files']
|
||||
mine=[f for f in queued if urlopen(f['url']).read()==b'LOCAL FINAL VERSION ONE']
|
||||
mine=[f for f in queued if urlopen(f['url']).read()==final_one]
|
||||
assert len(mine)==1 and mine[0]['name'].startswith('DTF-%d-item-1-' % mine[0]['number']), queued
|
||||
customer.call('/operator/queue/finals',expected=401)
|
||||
version=move('imp',version);version=move('cor',version)
|
||||
customer.call('/customer/orders/'+oid+'/files/'+final['id']+'/download',expected=404)
|
||||
premature_final=upload_bytes(customer,b'FINAL BEFORE CUSTOMER CORRECTION',order_id=oid)
|
||||
premature_final=upload_bytes(customer,final_png_bytes('premature'),name='LOCAL-PREMATURE-FINAL.png',order_id=oid)
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',
|
||||
{'version':version,'files':[{'item_index':0,'upload_id':premature_final}],
|
||||
'note':'Prepared before customer sent the new correction'},operator=True)['version']
|
||||
correction_id=upload_bytes(customer,b'LOCAL CORRECTED ORIGINAL')
|
||||
correction_id=upload_bytes(customer,final_png_bytes('correction'),name='LOCAL-CORRECTION.png')
|
||||
payload={'version':version,'files':[{'item_index':0,'upload_id':correction_id}],'note':'Replaced the artwork as requested'}
|
||||
guest.call('/customer/orders/'+oid+'/corrections',payload,expected=404)
|
||||
customer.call('/customer/orders/'+oid+'/corrections',{**payload,'version':0},expected=409)
|
||||
@@ -97,7 +98,7 @@ def run():
|
||||
# The customer's own correction approved as it is: not treated.
|
||||
assert treated() is None, treated()
|
||||
customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':correction_id}],'note':'Twice'},operator=True,expected=409)
|
||||
new_final=upload_bytes(customer,b'LOCAL FINAL VERSION TWO',order_id=oid)
|
||||
new_final=upload_bytes(customer,final_png_bytes('final two'),name='LOCAL-FINAL-TWO.png',order_id=oid)
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':[{'item_index':0,'upload_id':new_final}],'note':'Checked corrected final'},operator=True)['version']
|
||||
assert treated()=={'items':[0],'by':operator_email}, treated()
|
||||
stats=customer.call('/operator/stats?days=7',operator=True)['treated']
|
||||
@@ -128,7 +129,7 @@ def treating():
|
||||
approved_quote(customer,q,items)
|
||||
order=customer.call('/orders/dev-paid',{'quote_id':q['id']});oid=order['id'];number=order['number']
|
||||
files=lambda:[f for f in customer.call('/operator/orders/'+oid+'/files',operator=True) if f['kind']=='final' and f['active']]
|
||||
first=[upload_bytes(customer,b'LOCAL FIRST FINAL %d' % n,order_id=oid) for n in (1,2)]
|
||||
first=[upload_bytes(customer,final_png_bytes(f'first {n}'),name=f'LOCAL-FIRST-FINAL-{n}.png',order_id=oid) for n in (1,2)]
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',{'version':0,'note':'Aprovado',
|
||||
'files':[{'item_index':i,'upload_id':u} for i,u in enumerate(first)]},operator=True)['version']
|
||||
# Where each item is in the stage folder, named as the folders save it.
|
||||
@@ -137,7 +138,7 @@ def treating():
|
||||
assert all(f['name'].startswith('DTF-%d-item-%d' % (number,f['item'])) for f in folder['files']), folder
|
||||
customer.call('/operator/orders/'+oid+'/folder-files',expected=401)
|
||||
# Saved over with the same name and sent back: item 1 changes, item 2 keeps its final.
|
||||
png=b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR'+(6059).to_bytes(4,'big')+(2000).to_bytes(4,'big')+b'\x08\x06\x00\x00\x00'+b'\x00'*4
|
||||
png=final_png_bytes('treated')
|
||||
treated=upload_bytes(customer,png,name='DTF-%d-item-1.png' % number,order_id=oid)
|
||||
both=[{'item_index':0,'upload_id':treated},{'item_index':1,'upload_id':first[1]}]
|
||||
version=customer.call('/operator/orders/'+oid+'/final-files',{'version':version,'files':both,'note':'Arte tratada'},operator=True)['version']
|
||||
|
||||
Reference in New Issue
Block a user