Exemplo n.º 1
0
    def test_get_retry_countdown(self):
        wf = Workflow()
        with mock.patch('celery_dyrygent.workflows.workflow.random') as mck:
            mck.randint.return_value = 777
            res = wf.get_retry_countdown()

            mck.randint.assert_called_with(10, 30)

            assert res == 777

            wf._active_tick = True
            assert wf.get_retry_countdown() == 2
Exemplo n.º 2
0
    def test_get_retry_countdown(self):
        wf = Workflow()
        countdown = wf.get_retry_countdown()
        assert isinstance(countdown, int)

        # assumes default retry policy
        assert 10 <= countdown <= 30