feat: the Tiny test order cancels itself, and a guarded cancel for test orders left open
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 3m19s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
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 3m19s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m7s
Tiny has no delete, and the team's users cannot cancel by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -613,6 +613,26 @@ class TinyProbeTests(FakeTinyCase):
|
||||
self.assertEqual(len(self.orders), 1)
|
||||
self.assertEqual(self.orders[0]['itens'][0]['produto'], {'id': 104})
|
||||
self.assertIn('2º envio: already-created', text)
|
||||
# Then cancelled through the API, and read back: it does not stay open.
|
||||
self.assertEqual(self.orders[0]['situacao'], 2)
|
||||
self.assertIn(f"Pedido nº {self.orders[0]['numeroPedido']} cancelado no Tiny.", text)
|
||||
self.assertEqual(self.tags[self.orders[0]['id']], [{'descricao': 'KANBANDTF'}])
|
||||
|
||||
def test_cancelar_touches_only_test_orders(self):
|
||||
self.tiny.deliver('k1', PAID)
|
||||
real = self.orders[0]
|
||||
code, text = self.probe('cancelar', str(real['id']))
|
||||
self.assertEqual(code, 1)
|
||||
self.assertIn('não é um pedido de teste', text)
|
||||
self.assertEqual(real['situacao'], 0)
|
||||
self.assertNotIn('PUT', [method for method, _ in self.calls])
|
||||
# A test order left open is cancelled; asked again, it is already.
|
||||
test = tiny_probe_payload()
|
||||
self.tiny.deliver('k2', test)
|
||||
left = self.orders[-1]
|
||||
self.assertEqual(self.probe('cancelar', str(left['id']))[0], 0)
|
||||
self.assertEqual(left['situacao'], 2)
|
||||
self.assertEqual(self.probe('cancelar', str(left['id']))[0], 0)
|
||||
|
||||
def test_resend_is_skipped_when_the_search_cannot_find_the_order(self):
|
||||
from app import tiny_probe
|
||||
@@ -624,7 +644,15 @@ class TinyProbeTests(FakeTinyCase):
|
||||
lines = []
|
||||
self.assertFalse(tiny_probe.pedido(self.tiny, payload, True, lines.append, wait=lambda s: None))
|
||||
self.assertEqual(len(self.orders), 1)
|
||||
self.assertIn('o 2º envio não foi feito', lines[-1])
|
||||
self.assertIn('o 2º envio não foi feito', lines[-2])
|
||||
# Not left open all the same.
|
||||
self.assertEqual(self.orders[0]['situacao'], 2)
|
||||
self.assertIn('cancelado no Tiny', lines[-1])
|
||||
|
||||
|
||||
def tiny_probe_payload():
|
||||
from app import tiny_probe
|
||||
return tiny_probe.test_order('11222333000181', 'a@example.test', '16999999999', 'file')
|
||||
|
||||
|
||||
class DefaultSkuTests(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user