2020-09-24 16:51:49 -04:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
import pytz
|
|
|
|
|
2020-09-17 11:16:41 -04:00
|
|
|
from tests.base_test import BaseTest
|
|
|
|
|
|
|
|
|
|
|
|
from communicator import app
|
|
|
|
from communicator.models import Sample
|
|
|
|
from communicator.services.notification_service import TEST_MESSAGES, NotificationService
|
|
|
|
|
|
|
|
|
|
|
|
class TestNotificationService(BaseTest):
|
|
|
|
|
|
|
|
def test_send_notification(self):
|
|
|
|
message_count = len(TEST_MESSAGES)
|
|
|
|
sample = Sample(email="dan@stauntonmakerspace.com", result_code="1234")
|
2020-09-23 09:28:28 -04:00
|
|
|
with NotificationService(app) as notifier:
|
|
|
|
notifier.send_result_email(sample)
|
2020-09-17 11:16:41 -04:00
|
|
|
self.assertEqual(len(TEST_MESSAGES), message_count + 1)
|
2020-09-23 09:28:28 -04:00
|
|
|
self.assertEqual("UVA: BE SAFE Notification", self.decode(TEST_MESSAGES[-1]['subject']))
|
|
|
|
|
2020-09-24 16:51:49 -04:00
|
|
|
|