Skip to content

Commit

Permalink
Rename action to send_phone_notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansberry committed Dec 17, 2024
1 parent fce77fb commit 6d30138
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = logging.getLogger(__name__)


def send_twilio_notifications(context, data_dict):
def send_phone_notifications(context, data_dict):
"""
Sends SMS and Whatsapp notifications via the Twilio API. Both notification types
have been combined into a single action since they share a great deal of logic
Expand Down
4 changes: 2 additions & 2 deletions ckanext/dataset_subscriptions/plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckanext.dataset_subscriptions.actions import email_notifications, twilio_notifications, user
from ckanext.dataset_subscriptions.actions import email_notifications, phone_notifications, user


class DatasetSubscriptionsPlugin(plugins.SingletonPlugin):
Expand All @@ -17,7 +17,7 @@ def update_config(self, config_):
def get_actions(self):
return {
'send_email_notifications': email_notifications.send_email_notifications,
'send_twilio_notifications': twilio_notifications.send_twilio_notifications,
'send_phone_notifications': phone_notifications.send_phone_notifications,
'user_create': user.user_create,
'user_update': user.user_update,
'user_show': user.user_show,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from ckan.tests import helpers
from ckan.tests import factories as ckan_factories
from ckanext.dataset_subscriptions.tests import factories
from ckanext.dataset_subscriptions.actions import twilio_notifications
from ckanext.dataset_subscriptions.actions import phone_notifications
from unittest import mock


Expand Down Expand Up @@ -47,7 +47,7 @@ def create_user_with_resources(with_activity,
@pytest.mark.parametrize("notifications_enabled", [(False), (True)])
def test_sms_notifications_disabled_enabled(notifications_enabled):
user = create_user_with_resources(True, notifications_enabled, False)
notifications = twilio_notifications._sms_notifications_enabled(user, {})
notifications = phone_notifications._sms_notifications_enabled(user, {})
assert notifications == notifications_enabled


Expand All @@ -59,7 +59,7 @@ def test_if_sms_notifications_are_generated(create_message_mock, sysadmin_contex
create_user_with_resources(True, True, False)
expected_sid = 'SM87105da94bff44b999e4e6eb90d8eb6a'
create_message_mock.return_value.sid = expected_sid
sid = helpers.call_action("send_twilio_notifications")
sid = helpers.call_action("send_phone_notifications")
assert create_message_mock.called is True
assert sid[0] == expected_sid

Expand All @@ -72,7 +72,7 @@ def test_if_whatsapp_notifications_are_generated(create_message_mock, sysadmin_c
create_user_with_resources(True, False, True)
expected_sid = 'SM87105da94bff44b999e4e6eb90d8eb6a'
create_message_mock.return_value.sid = expected_sid
sid = helpers.call_action("send_twilio_notifications")
sid = helpers.call_action("send_phone_notifications")
assert create_message_mock.called is True
assert sid[0] == expected_sid
call_args = dict(create_message_mock.call_args.kwargs.items())
Expand Down

0 comments on commit 6d30138

Please sign in to comment.