Skip to content

Commit

Permalink
Squash #2137 - Rename method send_va_profile_email_status to send_va_…
Browse files Browse the repository at this point in the history
…profile_notification_status
  • Loading branch information
MackHalliday committed Dec 4, 2024
1 parent 6cae90e commit ffd59f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/celery/send_va_profile_notification_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ def send_notification_status_to_va_profile(notification_data: dict) -> None:
"""

try:
va_profile_client.send_va_profile_email_status(notification_data)
va_profile_client.send_va_profile_notification_status(notification_data)
except requests.Timeout:
# logging in send_va_profile_email_status
# logging in send_va_profile_notification_status
raise AutoRetryException
except requests.RequestException:
# logging in send_va_profile_email_status
# logging in send_va_profile_notification_status
# In this case the error is being handled by not retrying this celery task
pass
2 changes: 1 addition & 1 deletion app/va/va_profile/va_profile_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _handle_exceptions(self, va_profile_id_value: str, error: Exception):

raise exception from error

def send_va_profile_email_status(self, notification_data: dict) -> None:
def send_va_profile_notification_status(self, notification_data: dict) -> None:
"""
This method sends notification status data to VA Profile. This is part of our integration to help VA Profile
provide better service by letting them know which emails and phone numbers are good, and which ones result in bounces.
Expand Down
12 changes: 6 additions & 6 deletions tests/app/celery/test_process_ses_receipts_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,24 +644,24 @@ def mock_notification(self) -> Notification:
return notification_mock

def test_ut_send_email_status_to_va_profile(self, mocker):
mock_send_va_profile_email_status = mocker.patch(
'app.celery.send_va_profile_notification_status.va_profile_client.send_va_profile_email_status'
mock_send_va_profile_notification_status = mocker.patch(
'app.celery.send_va_profile_notification_status.va_profile_client.send_va_profile_notification_status'
)

send_notification_status_to_va_profile(self.mock_notification_data)

mock_send_va_profile_email_status.assert_called_once_with(self.mock_notification_data)
mock_send_va_profile_notification_status.assert_called_once_with(self.mock_notification_data)

def test_ut_send_email_status_to_va_profile_raises_auto_retry_exception(self, mocker):
mock_send_va_profile_email_status = mocker.patch(
'app.celery.send_va_profile_notification_status.va_profile_client.send_va_profile_email_status',
mock_send_va_profile_notification_status = mocker.patch(
'app.celery.send_va_profile_notification_status.va_profile_client.send_va_profile_notification_status',
side_effect=[ConnectTimeout, ReadTimeout],
)

with pytest.raises(AutoRetryException):
send_notification_status_to_va_profile(self.mock_notification_data)

mock_send_va_profile_email_status.assert_called_once()
mock_send_va_profile_notification_status.assert_called_once()


@pytest.mark.parametrize('status', (NOTIFICATION_PERMANENT_FAILURE, NOTIFICATION_TEMPORARY_FAILURE))
Expand Down
12 changes: 6 additions & 6 deletions tests/app/va/va_profile/test_va_profile_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,32 +499,32 @@ class TestSendEmailStatus:
'provider': 'ses', # email provider
}

def test_send_va_profile_email_status_sent_successfully(self, rmock, mock_va_profile_client, mocker):
def test_send_va_profile_notification_status_sent_successfully(self, rmock, mock_va_profile_client, mocker):
rmock.post(requests_mock.ANY, json=self.mock_response, status_code=200)

mock_va_profile_client.send_va_profile_email_status(self.mock_notification_data)
mock_va_profile_client.send_va_profile_notification_status(self.mock_notification_data)

assert rmock.called

expected_url = f'{MOCK_VA_PROFILE_URL}/contact-information-vanotify/notify/status'
assert rmock.request_history[0].url == expected_url

def test_send_va_profile_email_status_timeout(self, rmock, mock_va_profile_client, mocker):
def test_send_va_profile_notification_status_timeout(self, rmock, mock_va_profile_client, mocker):
rmock.post(requests_mock.ANY, exc=requests.ReadTimeout)

with pytest.raises(requests.Timeout):
mock_va_profile_client.send_va_profile_email_status(self.mock_notification_data)
mock_va_profile_client.send_va_profile_notification_status(self.mock_notification_data)

assert rmock.called

expected_url = f'{MOCK_VA_PROFILE_URL}/contact-information-vanotify/notify/status'
assert rmock.request_history[0].url == expected_url

def test_send_va_profile_email_status_throws_exception(self, rmock, mock_va_profile_client, mocker):
def test_send_va_profile_notification_status_throws_exception(self, rmock, mock_va_profile_client, mocker):
rmock.post(requests_mock.ANY, exc=requests.RequestException)

with pytest.raises(requests.RequestException):
mock_va_profile_client.send_va_profile_email_status(self.mock_notification_data)
mock_va_profile_client.send_va_profile_notification_status(self.mock_notification_data)

assert rmock.called

Expand Down

0 comments on commit ffd59f1

Please sign in to comment.