fix: Tiny's pickup is "Retirar pessoalmente", even with "Retirar na loja" there
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m9s
Build and deploy / Secret scan and release gate (push) Successful in 12s
Build and deploy / Publish images (push) Successful in 1m42s

Dropstar's Tiny has two formas de envio named like "retirar": "Retirar
pessoalmente", the one its team uses, and an unused "Retirar na loja", so
the lookup by name asked for a setting. The exact name now decides; two
other "retirar" methods still ask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-14 13:25:21 -03:00
parent 44458aea3e
commit f8d76ed27d
2 changed files with 13 additions and 3 deletions

View File

@@ -259,12 +259,16 @@ class TinyStatusTests(FakeTinyCase):
self.assertNotIn('transportador', order_payload(PICKUP, 1))
def test_pickup_forma_de_envio_is_found_by_name(self):
from app.tiny import check
from app.tiny import check, find_pickup
with mock.patch.dict(os.environ, {'TINY_FORMA_ENVIO_RETIRADA': ''}):
self.tiny.deliver('k1', PICKUP)
self.assertEqual(self.orders[0]['transportador'], {'formaEnvio': {'id': 77}})
self.assertEqual(check(orders=self.tiny)['forma de envio de retirada'], 'ok')
self.methods['79'] = {'id': 79, 'nome': 'Retirada na loja', 'tipo': '6'}
# Dropstar's account also has "Retirar na loja": the exact name wins.
self.methods['79'] = {'id': 79, 'nome': 'Retirar na loja', 'tipo': '6'}
self.assertEqual(check(orders=self.tiny)['forma de envio de retirada'], 'ok')
self.assertEqual(find_pickup(self.tiny)[0]['id'], 77)
self.methods['77']['nome'] = 'Retirar no balcão'
self.assertIn('mais de uma', check(orders=self.tiny)['forma de envio de retirada'])
del self.methods['77'], self.methods['79']
self.assertIn('nenhuma', check(orders=self.tiny)['forma de envio de retirada'])