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", [
|
2022-01-04 17:16:00 +01:00
|
|
|
("ussd.exit", "en", "+254712345678", "END Thank you for using the service."),
|
|
|
|
("ussd.exit", "sw", "+254712345678", "END Asante kwa kutumia huduma.")
|
2021-02-06 16:13:47 +01:00
|
|
|
])
|
|
|
|
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
|
|
|
|
2021-03-04 17:47:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|