fix: Prova OK approves every part of a film, and "Gerar de novo" names the new files with a version (#114, #128, #130)
Some checks failed
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Some checks failed
Build and deploy / Validate source (push) Successful in 16s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
The proof's approval took the print file's first upload as the final, so the other parts of a film in parts never reached Arte conferida or the hot folder and were downloaded by hand. It now approves every part, and adds the missing ones to a first part already approved. A one-off migration completes the open orders still before Imprimindo. Generated again, the files are named DTF-130-v2-item-1-p2.png, as Marcus asked, so the FlexiPRINT queue and the Hoson list never take them for the first ones. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -219,6 +219,8 @@ def run():
|
||||
assert (state, finals, back['reason'], back['back']) == ('rec', 0, 'Arquivo gerado de novo', True), (state, finals, back)
|
||||
again, remade = wait_print(client, again['id'], 'ready')
|
||||
assert str(remade['upload_id']) != str(made['upload_id']), (made, remade)
|
||||
# Its name carries the version, so it is not taken for the first (#130).
|
||||
assert remade['name'] == 'DTF-%d-v2-item-1.png' % again['number'], remade['name']
|
||||
print('PASS: a ready file is generated again from Arte conferida, back in Arte recebida to approve')
|
||||
|
||||
# The generated file approved, sent to Correção (its final stops counting)
|
||||
|
||||
@@ -145,6 +145,9 @@ class PrintFileTests(unittest.TestCase):
|
||||
self.assertNotIn(b'ESPELHADO', footer_commands(footer(job, item([placement(0, 0, 20, 10)], [source(20, 10)], 10)), (100, 80)))
|
||||
# The files start with the code the Kanban copies.
|
||||
self.assertEqual(file_prefix(7, 1), 'DTF-7-item-2')
|
||||
# Generated again: the version in the name (Marcus, 2026-11-27, #130).
|
||||
self.assertEqual(file_prefix(130, 0, 2), 'DTF-130-v2-item-1')
|
||||
self.assertEqual(file_prefix(130, 0, 1), 'DTF-130-item-1')
|
||||
|
||||
def test_jpeg_bytes_are_embedded_unchanged(self):
|
||||
path = self.save(quadrants(), 'a.jpg', quality=90)
|
||||
|
||||
64
tests/test_proof_parts.py
Normal file
64
tests/test_proof_parts.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""Prova OK approves every part of a film in parts (#114, #128, #130): only
|
||||
the first part became a final, and the others never reached the folders.
|
||||
|
||||
Run from the repository root: python3 -m unittest tests.test_proof_parts -v.
|
||||
"""
|
||||
import unittest
|
||||
|
||||
from app.proof import approve_parent
|
||||
|
||||
|
||||
class Rows:
|
||||
def __init__(self, rows):
|
||||
self.rows = rows
|
||||
|
||||
def fetchone(self):
|
||||
return self.rows[0] if self.rows else None
|
||||
|
||||
def fetchall(self):
|
||||
return self.rows
|
||||
|
||||
|
||||
class Database:
|
||||
"""Just the reads and writes approve_parent makes."""
|
||||
|
||||
def __init__(self, parts, active):
|
||||
self.parts, self.active, self.inserted = parts, active, []
|
||||
|
||||
def execute(self, sql, params=()):
|
||||
text = ' '.join(sql.split())
|
||||
if 'proof_result' in text:
|
||||
return Rows([{'number': 131}])
|
||||
if 'FROM dtf_local.print_files' in text:
|
||||
return Rows([{'item_index': 0, 'upload_id': self.parts[0]}])
|
||||
if 'FROM dtf_local.print_parts' in text:
|
||||
return Rows([{'upload_id': u} for u in self.parts])
|
||||
if text.startswith('SELECT upload_id FROM dtf_local.order_files'):
|
||||
return Rows([{'upload_id': u} for u in self.active])
|
||||
if text.startswith('INSERT INTO dtf_local.order_files'):
|
||||
self.inserted.append(params[2])
|
||||
return Rows([{'ok': 1}])
|
||||
|
||||
|
||||
ORDER = {'id': 'o', 'state': 'rec', 'cancelled_at': None, 'snapshot': {'items': [{'mode': 'file'}]}}
|
||||
|
||||
|
||||
class ProofPartsTests(unittest.TestCase):
|
||||
def test_every_part_becomes_a_final(self):
|
||||
db = Database(['p1', 'p2', 'p3'], set())
|
||||
approve_parent(db, ORDER, 'Prumo')
|
||||
self.assertEqual(db.inserted, ['p1', 'p2', 'p3'])
|
||||
|
||||
def test_the_missing_parts_join_a_first_part_already_approved(self):
|
||||
db = Database(['p1', 'p2'], {'p1'})
|
||||
approve_parent(db, ORDER, 'Prumo')
|
||||
self.assertEqual(db.inserted, ['p2'])
|
||||
|
||||
def test_a_final_someone_prepared_stays(self):
|
||||
db = Database(['p1', 'p2'], {'treated'})
|
||||
approve_parent(db, ORDER, 'Prumo')
|
||||
self.assertEqual(db.inserted, [])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user