fix: an out-of-range cart timing is dropped, never refuses the quote
DTF-WEB-9: a cart left open for about 6 hours sent upload_ms 23556292, above the 1 h limit, and POST /quotes answered 422: the customer could not pay. The timings only feed Números, so a value out of range is now dropped; an unknown field is still refused. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,5 +31,22 @@ class SpeedFiguresTests(unittest.TestCase):
|
||||
self.assertTrue(all(row['average'] is None and row['samples'] == 0 for row in rows))
|
||||
|
||||
|
||||
class ClientTimingsTests(unittest.TestCase):
|
||||
def test_a_value_out_of_range_is_dropped_not_refused(self):
|
||||
"""DTF-WEB-9: a cart left open for 6 h sent upload_ms 23556292 and
|
||||
the customer could not pay."""
|
||||
from app.core.models import ClientTimings
|
||||
timings = ClientTimings.model_validate({'upload_ms': 23556292, 'analysis_ms': 5000,
|
||||
'page_ms': -1, 'montage_ms': 1.5, 'upload_bytes': True})
|
||||
self.assertEqual(timings.model_dump(), {'page_ms': None, 'upload_ms': None, 'upload_bytes': None,
|
||||
'analysis_ms': 5000, 'montage_ms': None})
|
||||
|
||||
def test_an_unknown_field_is_still_refused(self):
|
||||
from pydantic import ValidationError
|
||||
from app.core.models import ClientTimings
|
||||
with self.assertRaises(ValidationError):
|
||||
ClientTimings.model_validate({'other_ms': 1})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user