add CBC_PROXY_ENABLED config flag to control if tasks are triggered

previously we made some incorrect assumptions about set-up on staging
and prod - they currently don't have any cbc_proxy aws creds at all.

We shoudn't be attempting canaries or link tests when there's no AWS
infrastructure to connect to.

We also shouldn't bother writing a row into the database at all for the
broadcast_provider_message since we're not even attempting to send, and
we shouldn't get confused between messages that failed and messages we
never wanted to send at all.
This commit is contained in:
Leo Hemsted
2020-11-25 17:39:32 +00:00
parent 54fecf2182
commit e2fa0116a0
7 changed files with 57 additions and 8 deletions

View File

@@ -31,6 +31,18 @@ def test_send_broadcast_event_queues_up_for_active_providers(mocker, notify_api)
]
def test_send_broadcast_event_does_nothing_if_cbc_proxy_disabled(mocker, notify_api):
mock_send_broadcast_provider_message = mocker.patch(
'app.celery.broadcast_message_tasks.send_broadcast_provider_message',
)
event_id = uuid.uuid4()
with set_config(notify_api, 'ENABLED_CBCS', ['ee', 'vodafone']), set_config(notify_api, 'CBC_PROXY_ENABLED', False):
send_broadcast_event(event_id)
assert mock_send_broadcast_provider_message.apply_async.called is False
@freeze_time('2020-08-01 12:00')
def test_send_broadcast_provider_message_sends_data_correctly(mocker, sample_service):
template = create_template(sample_service, BROADCAST_TYPE)