cic-stack/apps/cic-ussd/tests/cic_ussd/test_notifications.py

33 lines
992 B
Python
Raw Normal View History

2021-02-06 16:13:47 +01:00
# standard imports
2021-08-06 18:29:01 +02:00
# external imports
2021-02-06 16:13:47 +01:00
import pytest
# local imports
from cic_ussd.notifications import Notifier
@pytest.mark.parametrize("key, preferred_language, recipient, expected_message", [
("ussd.kenya.exit", "en", "+254712345678", "END Thank you for using the service."),
("ussd.kenya.exit", "sw", "+254712345678", "END Asante kwa kutumia huduma.")
])
def test_send_sms_notification(celery_session_worker,
expected_message,
key,
2021-08-06 18:29:01 +02:00
mock_notifier_api,
2021-02-06 16:13:47 +01:00
preferred_language,
recipient,
2021-08-06 18:29:01 +02:00
set_locale_files):
2021-02-06 16:13:47 +01:00
notifier = Notifier()
notifier.queue = None
notifier.send_sms_notification(key=key, phone_number=recipient, preferred_language=preferred_language)
2021-08-06 18:29:01 +02:00
assert mock_notifier_api.get('message') == expected_message
assert mock_notifier_api.get('recipient') == recipient
2021-02-06 16:13:47 +01:00