feat: UV goes to Tiny as whole metres of DTFIMP.UV.1MT, then DTFIMP.UV.010CM
All checks were successful
Build and deploy / Validate source (push) Successful in 1m22s
Build and deploy / Integration suite on a real stack (push) Successful in 3m12s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 58s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m22s
Build and deploy / Integration suite on a real stack (push) Successful in 3m12s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 58s
The client registered UV as a metre SKU and a 10 cm SKU. With TINY_SKU_METRO_<MODE> beside TINY_SKU10_<MODE>, 2,30 m goes as 2 × the metre SKU and 3 × the 10 cm one, at the price the customer paid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -336,6 +336,32 @@ class TinyStepSkuTests(FakeTinyCase):
|
||||
self.assertIn('DTFIMP.UV.010CM', check(orders=self.tiny)['DTF UV 28,5 cm · folha montada'])
|
||||
|
||||
|
||||
@mock.patch.dict(os.environ, {**PRODUCTS, 'TINY_SKU10_UV_FOLHA': 'DTFIMP.UV.010CM',
|
||||
'TINY_SKU_METRO_UV_FOLHA': 'DTFIMP.UV.1MT'})
|
||||
class TinyMetreAndStepSkuTests(FakeTinyCase):
|
||||
"""UV as the client registered it: DTFIMP.UV.1MT per metre and DTFIMP.UV.010CM per 10 cm."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.products['300'] = {'id': 300, 'sku': 'DTFIMP.UV.010CM', 'descricao': 'UV 10 cm', 'situacao': 'A'}
|
||||
self.products['301'] = {'id': 301, 'sku': 'DTFIMP.UV.1MT', 'descricao': 'UV 1 metro', 'situacao': 'A'}
|
||||
|
||||
def test_whole_metres_then_ten_centimetre_steps(self):
|
||||
self.tiny.deliver('k1', UV)
|
||||
lines = [(i['produto']['id'], i['quantidade'], i['valorUnitario']) for i in self.orders[0]['itens']]
|
||||
# 2,30 m at R$ 69,90: 2 × "1 metro" + 3 × "10 cm", R$ 160,77 in all.
|
||||
self.assertEqual(lines, [(301, 2, 69.9), (300, 3, 6.99)])
|
||||
self.assertAlmostEqual(sum(q * v for _, q, v in lines), 160.77)
|
||||
|
||||
def test_whole_metres_alone_and_the_check(self):
|
||||
from app.tiny import check, step_lines
|
||||
self.assertEqual(step_lines({'billed_metres': '2', 'unit_cents': 6990}, 'C', 'M'), [('M', 2, 6990)])
|
||||
self.assertEqual(check(orders=self.tiny)['DTF UV 28,5 cm · folha montada'], 'ok')
|
||||
del self.products['301']
|
||||
self.tiny.skus.clear()
|
||||
self.assertIn('DTFIMP.UV.1MT', check(orders=self.tiny)['DTF UV 28,5 cm · folha montada'])
|
||||
|
||||
|
||||
@mock.patch.dict(os.environ, PRODUCTS)
|
||||
class TinyProbeTests(FakeTinyCase):
|
||||
"""The supervised console tool run against the fake Tiny."""
|
||||
|
||||
Reference in New Issue
Block a user