feat: Prumo tells the card and the customer what it did (front 6)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 4m41s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m6s
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 4m41s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m6s
Every order now carries a short report of the decisions that happened: original format, conversion, resolution, background, residue, montage, billed length, contraction, thin-stroke warning, parts and generation time. The card shows it above the file; the payment summary shows the customer's version. The upload keeps the original name so a renamed CDR/PDF is told.
This commit is contained in:
48
tests/test_prumo.py
Normal file
48
tests/test_prumo.py
Normal file
@@ -0,0 +1,48 @@
|
||||
"""The Prumo report: only what happened, in the order it happened (front 6)."""
|
||||
import unittest
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from app.prumo import customer_summary, report
|
||||
|
||||
|
||||
class PrumoReportTests(unittest.TestCase):
|
||||
def order(self):
|
||||
item = {
|
||||
'mode': 'avulsa', 'billed_metres': '1.30', 'metres': '1.30',
|
||||
'uploads': ['u1'], 'source_dpi': 96, 'residue_accepted': 3,
|
||||
'residue_accepted_at': '2026-11-05T17:32:00+00:00',
|
||||
'stroke_px': 6, 'stroke_class': 'C2', 'stroke_choice': 'measured',
|
||||
'production': {'height_cm': '130', 'placements': [
|
||||
{'rotation_degrees': 0}, {'rotation_degrees': 90}]},
|
||||
}
|
||||
started = datetime(2026, 11, 5, 14, 0, tzinfo=timezone.utc)
|
||||
return {'snapshot': {'items': [item]}, 'print_files': [{
|
||||
'item_index': 0, 'created_at': started, 'finished_at': started + timedelta(seconds=41),
|
||||
'detail': {'format': 'png', 'dpi': 300, 'parts': [
|
||||
{'from_cm': '0', 'to_cm': '15'}, {'from_cm': '15', 'to_cm': '16'}]},
|
||||
}]}
|
||||
|
||||
def test_card_report_reads_the_decisions(self):
|
||||
lines = report(self.order(), {'u1': {'name': 'arte.pdf', 'original_name': 'arte.cdr'}})
|
||||
text = '\n'.join(lines)
|
||||
self.assertIn('Chegou CDR, era PDF por dentro', text)
|
||||
self.assertIn('PDF → PNG 300 DPI', text)
|
||||
self.assertIn('Veio em 96 DPI, ampliado para 300', text)
|
||||
self.assertIn('3 pontos < 2 mm — cliente aceitou', text)
|
||||
self.assertIn('2 artes, 1 girada', text)
|
||||
self.assertIn('Menor traço 6 px → C2', text)
|
||||
self.assertIn('cliente escolheu imprimir em C1', text)
|
||||
self.assertIn('2 partes (15,00 + 1,00)', text)
|
||||
self.assertIn('Prumo levou 41 s', text)
|
||||
|
||||
def test_customer_summary_is_plain_language(self):
|
||||
lines = customer_summary(self.order()['snapshot']['items'])
|
||||
text = ' '.join(lines)
|
||||
self.assertIn('96 DPI', text)
|
||||
self.assertIn('3 pontinhos', text)
|
||||
self.assertIn('C2', text)
|
||||
self.assertIn('C1', text)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user