@@ -802,26 +802,42 @@ def test_update_status_of_fully_processed_jobs(mocker, sample_email_template, mo
802802
803803
804804@pytest .mark .parametrize (
805- "failure_rates, sms_to_tv_numbers, expected_log , expected_message" ,
805+ "failure_rates, sms_to_tv_numbers, expected_logs , expected_message" ,
806806 [
807807 [
808- [MockServicesWithHighFailureRate ("123" , 0.3 )],
808+ [MockServicesWithHighFailureRate ("123" , 0.3 ), MockServicesWithHighFailureRate ( "456" , 0.7 ) ],
809809 [],
810- "Service 123 has had a high permanent-failure rate (0.3) for text messages in the last 24 hours" ,
811- "1 service(s) have had high permanent-failure rates for sms messages in last "
812- "24 hours:\n service: {}/services/{} failure rate: 0.3,\n " .format (Config .ADMIN_BASE_URL , "123" ),
810+ [
811+ "Service 123 has had a high permanent-failure rate (0.3) for text messages in the last 24 hours" ,
812+ "Service 456 has had a high permanent-failure rate (0.7) for text messages in the last 24 hours" ,
813+ ],
814+ "2 service(s) have had high permanent-failure rates for sms messages in last 24 hours:\n "
815+ f"service: { Config .ADMIN_BASE_URL } /services/123 failure rate: 0.3,\n "
816+ f"service: { Config .ADMIN_BASE_URL } /services/456 failure rate: 0.7,\n " ,
813817 ],
814818 [
815819 [],
816820 [MockServicesSendingToTVNumbers ("123" , 567 )],
817- "Service 123 has sent 567 text messages to tv numbers in the last 24 hours" ,
821+ ["Service 123 has sent 567 text messages to tv numbers in the last 24 hours" ],
822+ "1 service(s) have sent over 500 sms messages to tv numbers in last 24 hours:\n "
823+ f"service: { Config .ADMIN_BASE_URL } /services/123 count of sms to tv numbers: 567,\n " ,
824+ ],
825+ [
826+ [MockServicesWithHighFailureRate ("123" , 0.3 )],
827+ [MockServicesSendingToTVNumbers ("456" , 567 )],
828+ [
829+ "Service 123 has had a high permanent-failure rate (0.3) for text messages in the last 24 hours" ,
830+ "Service 456 has sent 567 text messages to tv numbers in the last 24 hours" ,
831+ ],
832+ "1 service(s) have had high permanent-failure rates for sms messages in last 24 hours:\n "
833+ f"service: { Config .ADMIN_BASE_URL } /services/123 failure rate: 0.3,\n "
818834 "1 service(s) have sent over 500 sms messages to tv numbers in last 24 hours:\n "
819- "service: {}/services/{} count of sms to tv numbers: 567,\n " . format ( Config . ADMIN_BASE_URL , "123" ) ,
835+ f "service: { Config . ADMIN_BASE_URL } /services/456 count of sms to tv numbers: 567,\n " ,
820836 ],
821837 ],
822838)
823839def test_check_for_services_with_high_failure_rates_or_sending_to_tv_numbers (
824- notify_db_session , failure_rates , sms_to_tv_numbers , expected_log , expected_message , caplog , mocker
840+ notify_db_session , failure_rates , sms_to_tv_numbers , expected_logs , expected_message , caplog , mocker
825841):
826842 mock_create_ticket = mocker .spy (NotifySupportTicket , "__init__" )
827843 mock_send_ticket_to_zendesk = mocker .patch (
@@ -842,7 +858,7 @@ def test_check_for_services_with_high_failure_rates_or_sending_to_tv_numbers(
842858
843859 assert mock_failure_rates .called
844860 assert mock_sms_to_tv_numbers .called
845- assert expected_log in caplog .messages
861+ assert set ( expected_logs ) == set ( caplog .messages )
846862 mock_create_ticket .assert_called_with (
847863 ANY ,
848864 message = expected_message + zendesk_actions ,
0 commit comments