def test_trigger_link_tests_calls_for_all_providers(mocker, notify_api): mock_trigger_link_test = mocker.patch( 'app.celery.scheduled_tasks.trigger_link_test', ) with set_config(notify_api, 'ENABLED_CBCS', ['ee', 'vodafone']): trigger_link_tests() assert mock_trigger_link_test.apply_async.call_args_list == [ call(kwargs={'provider': 'ee'}, queue='notify-internal-tasks'), call(kwargs={'provider': 'vodafone'}, queue='notify-internal-tasks') ]
def test_trigger_link_does_nothing_if_cbc_proxy_disabled(mocker, notify_api): mock_trigger_link_test = mocker.patch( 'app.celery.scheduled_tasks.trigger_link_test', ) with set_config(notify_api, 'ENABLED_CBCS', ['ee', 'vodafone']), set_config(notify_api, 'CBC_PROXY_ENABLED', False): trigger_link_tests() assert mock_trigger_link_test.called is False
def test_trigger_link_tests_invokes_cbc_proxy_client( mocker, ): mock_send_link_test = mocker.patch( 'app.cbc_proxy_client.send_link_test', ) scheduled_tasks.trigger_link_tests() mock_send_link_test.assert_called # the 0th argument of the call to send_link_test identifier = mock_send_link_test.mock_calls[0][1][0] try: uuid.UUID(identifier) except BaseException: pytest.fail(f"{identifier} is not a valid uuid")