1- import json
21from datetime import datetime , timedelta
32from unittest .mock import ANY , MagicMock , patch
43
@@ -188,7 +187,7 @@ def test_handle_with_unrecoverable_failures(
188187 def test_handle_with_recoverable_failures (
189188 self , mark_batch_as_sent , mock_send_message_batch , status_code
190189 ):
191- """Test that message batches which fail to send are marked correctly """
190+ """Test that message batches which fail to send are marked as unrecoverable """
192191 notify_errors = {"errors" : [{"some-error" : "details" }]}
193192 mock_send_message_batch .return_value .status_code = status_code
194193 mock_send_message_batch .return_value .json .return_value = notify_errors
@@ -198,22 +197,12 @@ def test_handle_with_recoverable_failures(
198197 )
199198 routing_plan_id = RoutingPlan .for_episode_type (appointment .episode_type ).id
200199
201- with patch (
202- "manage_breast_screening.notifications.views.Queue.RetryMessageBatches"
203- ) as mock_queue :
204- queue_instance = MagicMock ()
205- mock_queue .return_value = queue_instance
206- Command ().handle ()
200+ Command ().handle ()
207201
208202 message_batches = MessageBatch .objects .filter (routing_plan_id = routing_plan_id )
209203 assert message_batches .count () == 1
210- assert message_batches [0 ].status == "failed_recoverable "
204+ assert message_batches [0 ].status == "failed_unrecoverable "
211205 assert message_batches [0 ].nhs_notify_errors == notify_errors
212- queue_instance .add .assert_called_once_with (
213- json .dumps (
214- {"message_batch_id" : str (message_batches [0 ].id ), "retry_count" : 0 }
215- )
216- )
217206
218207 def test_handle_does_nothing_on_weekend (
219208 self , mock_mark_batch_as_sent , mock_send_message_batch , time_machine
0 commit comments