diff --git a/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst b/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst index 96877189ed..d082865841 100644 --- a/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst +++ b/modules/edocument_peppol_peppyrus/tests/scenario_edocument_peppol_peppyrus.rst @@ -5,6 +5,7 @@ EDocument Peppol Peppyrus Scenario Imports:: >>> import os + >>> import time >>> from unittest.mock import patch >>> from proteus import Model @@ -13,6 +14,8 @@ Imports:: >>> from trytond.tests.tools import activate_modules >>> from trytond.tools import file_open + >>> FETCH_SLEEP, MAX_SLEEP = 1, 20 + Patch Peppol:: >>> _validate = patch.object(Peppol, '_validate').start() @@ -69,10 +72,13 @@ Check Peppol status:: Fetch messages:: - >>> cron, = Cron.find([ - ... ('method', '=', 'edocument.peppol.service|peppyrus_fetch'), - ... ], limit=1) - >>> cron.click('run_once') - + >>> for _ in range(MAX_SLEEP): + ... cron, = Cron.find([ + ... ('method', '=', 'edocument.peppol.service|peppyrus_fetch'), + ... ], limit=1) + ... cron.click('run_once') + ... if bool(Peppol.find([('direction', '=', 'in')])): + ... break + ... time.sleep(FETCH_SLEEP) >>> bool(Peppol.find([('direction', '=', 'in')])) True