fix: Tiny's connection test no longer times out listing orders
All checks were successful
Build and deploy / Validate source (push) Successful in 1m38s
Build and deploy / Integration suite on a real stack (push) Successful in 4m33s
Build and deploy / Secret scan and release gate (push) Successful in 11s
Build and deploy / Publish images (push) Successful in 1m51s

"Testar conexão" asked Tiny for one order with no filter, and on the
client's account Tiny answered 400 "Sua consulta levou muito tempo". It now
asks for orders since yesterday, which proves the same permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-14 10:54:19 -03:00
parent 914c55c329
commit 3c9f05041e
2 changed files with 16 additions and 3 deletions

View File

@@ -151,6 +151,16 @@ class TinyTests(FakeTinyCase):
self.assertIn('não está ativo', results['DTF UV 28,5 cm · folha montada'])
self.assertEqual(results['DTF UV 28,5 cm · artes avulsas'], 'TINY_PRODUCT_UV_AVULSA sem id')
self.assertEqual(results['pedidos'], 'ok')
# The order list is asked by date: unfiltered, Tiny times out on a large account.
asked = []
def timing_out(request):
if request.url.path.endswith('/pedidos'):
asked.append(dict(request.url.params))
if 'dataInicial' not in request.url.params:
return httpx.Response(400, json={'mensagem': 'Sua consulta levou muito tempo.'})
return self.handler(request)
self.assertEqual(check(auth=FakeAuth(), transport=httpx.MockTransport(timing_out))['pedidos'], 'ok')
self.assertEqual(asked[-1]['limit'], '1')
denied = check(auth=FakeAuth(), transport=httpx.MockTransport(lambda r: httpx.Response(403, text='forbidden')))
self.assertTrue(denied['pedidos'].startswith('GET /pedidos: 403'))