feat: a Tiny order can sell UV as the client's one SKU per 10 cm
All checks were successful
Build and deploy / Validate source (push) Successful in 15s
Build and deploy / Integration suite on a real stack (push) Successful in 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m7s
All checks were successful
Build and deploy / Validate source (push) Successful in 15s
Build and deploy / Integration suite on a real stack (push) Successful in 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m7s
Dropstar sells UV only as DTFIMP.UV.010CM, per 10 cm. TINY_SKU10_<MODE> names such a SKU: 2,30 m goes to Tiny as 23 of it at the price the customer paid, with a rest that does not divide on a line of its own so the order adds up to the cent. "Testar conexão" and tiny_probe conferir check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -304,6 +304,38 @@ class TinySkuTests(FakeTinyCase):
|
||||
self.assertEqual(self.orders, [])
|
||||
|
||||
|
||||
UV = {**PAID, 'order': {**PAID['order'], 'items': [
|
||||
{'mode': 'uvfile', 'grade': 100, 'billed_metres': '2.3', 'unit_cents': 6990, 'total_cents': 16077}]}}
|
||||
|
||||
|
||||
@mock.patch.dict(os.environ, {**PRODUCTS, 'TINY_SKU10_UV_FOLHA': 'DTFIMP.UV.010CM'})
|
||||
class TinyStepSkuTests(FakeTinyCase):
|
||||
"""UV sold as one SKU per 10 cm, the only UV SKU the client has."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.products['300'] = {'id': 300, 'sku': 'DTFIMP.UV.010CM', 'descricao': 'UV 10 cm', 'situacao': 'A'}
|
||||
|
||||
def test_the_length_in_ten_centimetre_steps_at_the_price_paid(self):
|
||||
self.tiny.deliver('k1', UV)
|
||||
lines = [(i['produto']['id'], i['quantidade'], i['valorUnitario']) for i in self.orders[0]['itens']]
|
||||
self.assertEqual(lines, [(300, 23, 6.99)]) # 2,30 m at R$ 69,90 = R$ 160,77
|
||||
|
||||
def test_a_rest_that_does_not_divide_gets_its_own_line(self):
|
||||
from app.tiny import step_lines
|
||||
lines = step_lines({'billed_metres': '1.3', 'unit_cents': 1495}, 'C')
|
||||
self.assertEqual(lines, [('C', 12, 149), ('C', 1, 155)])
|
||||
self.assertEqual(sum(q * c for _, q, c in lines), 1943)
|
||||
|
||||
def test_settings_and_check_know_the_step_sku(self):
|
||||
from app.tiny import check, required_settings
|
||||
self.assertNotIn('TINY_PRODUCT_UV_FOLHA', required_settings())
|
||||
self.assertEqual(check(orders=self.tiny)['DTF UV 28,5 cm · folha montada'], 'ok')
|
||||
del self.products['300']
|
||||
self.tiny.skus.clear()
|
||||
self.assertIn('DTFIMP.UV.010CM', 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