From 22f08d37c3ca03a0c99acb3619dc6892fa04198b Mon Sep 17 00:00:00 2001 From: Stephen McMurtry Date: Tue, 14 Jan 2025 14:22:59 +0000 Subject: [PATCH] format --- tests/app/clients/test_freshdesk.py | 36 +++++++++++++---------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/app/clients/test_freshdesk.py b/tests/app/clients/test_freshdesk.py index 9fae9fa2cf..f90e05b82f 100644 --- a/tests/app/clients/test_freshdesk.py +++ b/tests/app/clients/test_freshdesk.py @@ -334,36 +334,32 @@ def test_email_freshdesk_ticket(self, mocker, notify_api: Flask, contact_form_em class TestEmailFreshdeskSensitiveService: def test_email_freshdesk_ticket_sensitive_service_success(self, mocker, notify_api): """Test successful sending of sensitive service email""" - mock_email_ticket = mocker.patch.object(freshdesk.Freshdesk, 'email_freshdesk_ticket') - - with set_config_values(notify_api, { - "SENSITIVE_SERVICE_EMAIL": "sensitive@test.gov.uk", - "CONTACT_FORM_SENSITIVE_SERVICE_EMAIL_TEMPLATE_ID": "template-123" - }): + mock_email_ticket = mocker.patch.object(freshdesk.Freshdesk, "email_freshdesk_ticket") + + with set_config_values( + notify_api, + { + "SENSITIVE_SERVICE_EMAIL": "sensitive@test.gov.uk", + "CONTACT_FORM_SENSITIVE_SERVICE_EMAIL_TEMPLATE_ID": "template-123", + }, + ): with notify_api.app_context(): freshdesk_client = freshdesk.Freshdesk(ContactRequest(email_address="user@example.com")) freshdesk_client.email_freshdesk_ticket_sensitive_service() - mock_email_ticket.assert_called_once_with( - "sensitive@test.gov.uk", - "template-123" - ) + mock_email_ticket.assert_called_once_with("sensitive@test.gov.uk", "template-123") def test_email_freshdesk_ticket_sensitive_service_no_email(self, mocker, notify_api): """Test handling when sensitive service email not configured""" - mock_email_ticket = mocker.patch.object(freshdesk.Freshdesk, 'email_freshdesk_ticket') - mock_logger = mocker.patch('app.clients.freshdesk.current_app.logger.error') + mock_email_ticket = mocker.patch.object(freshdesk.Freshdesk, "email_freshdesk_ticket") + mock_logger = mocker.patch("app.clients.freshdesk.current_app.logger.error") - with set_config_values(notify_api, { - "SENSITIVE_SERVICE_EMAIL": None, - "CONTACT_FORM_SENSITIVE_SERVICE_EMAIL_TEMPLATE_ID": "template-123" - }): + with set_config_values( + notify_api, {"SENSITIVE_SERVICE_EMAIL": None, "CONTACT_FORM_SENSITIVE_SERVICE_EMAIL_TEMPLATE_ID": "template-123"} + ): with notify_api.app_context(): freshdesk_client = freshdesk.Freshdesk(ContactRequest(email_address="user@example.com")) freshdesk_client.email_freshdesk_ticket_sensitive_service() mock_logger.assert_called_once_with("Sensitive service email address not set") - mock_email_ticket.assert_called_once_with( - None, - "template-123" - ) + mock_email_ticket.assert_called_once_with(None, "template-123")