runbot/runbot/tests/test_batch.py
William Braeckman 833b4e29d0 [IMP] runbot: add configurable process delay
Adds a configurable process delay on projects.
It can be used to reduce or otherwise increase the time between a push
and a batch starting.
2024-11-27 11:18:16 +01:00

21 lines
509 B
Python

from datetime import timedelta
from odoo import fields
from .common import RunbotCase
class TestBatch(RunbotCase):
def test_process_delay(self):
self.project.process_delay = 120
self.additionnal_setup()
batch = self.branch_addons.bundle_id.last_batch
batch._process()
self.assertEqual(batch.state, 'preparing')
batch.last_update = fields.Datetime.now() - timedelta(seconds=120)
batch._process()
self.assertEqual(batch.state, 'ready')